Some more cmts...
[about REs]
| () can be used to group parts of a regular expression
^^^
But does a lot more than that, with side-effects. For simple grouping
you can use (?: ... ) instead.
| if ($phone =~ /\d{3}\-\d{4}/) {
if ($phone =~ /\d{3}-\d{4}/) {
| The return statement is actually optional; if it is missing, then the subroutine will return the
| value of the last expression calculated, or undef if no expressions were calculated.
But it becomes necessary if one wants to exit early from a sub, as is
often the case e.g. with recursive ones...
| Variables local to a function can be declared with the my operator, so the previous function
| could be written:
Variables local to "anything"! As you should have clearly stated much
above...
| accesses the global variable by name. And, for reasons which are best left to Perl wizards to
| explain, you can't use my on a file handle, you have to use local.
But with recent enough perls it is much better and highly recommended
to use lexical filehandles (unless backwards compatibility is an
issue), as you may explain in the section about open():
my $all = do {
open my $fh, '<', $file or die $!;
local $/;
<$fh> };
Hmmm, seems like eventually I finished it! These are more or less the
cmts and suggestion I felt like giving about your work. Other posters
(Hey, Ben!!) may correct me if, as is unfortunately usual, further
imprecisions have inadvertently slipped in...
Michele