I just installed ActivePerl from ActiveState. The installation was painless and so far it has worked perfectly. It's not that I really wanted to learn Perl, it is just that many of the examples in "Regular Expressions, Powerful Techniques for Perl and Other Tools" by Jeffrey E. F. Friedl, from O'Reilly are demonstrated in Perl. It seems like a really concise and powerful language.
Here is my progress...not much I know. Guess this is equivalent to "Hello World" for demonstrating regular expressions in Perl.
print "Enter a temperature in Celsius:\n";
$celsius =
chomp($celsius);
if ($celsius =~ m/^([-+]?[0-9]+)([CF])$/) {
$fahrenheit = ($celsius * 9 / 5) + 32;
printf "%.2f C is %.2f F\n", $celsius, $fahrenheit;
}
else{
print "Expecting a number, so don't understand \"$celsius\".\n";
}
No comments:
Post a Comment