> perl -v
This is perl, v5.10.1 (*) built for i686-cygwin-thread-multi-64int
(with 13 registered patches, see perl -V for more detail)
Copyright 1987-2009, Larry Wall
Perl may be copied only under the terms of either the Artistic License
+ or the
GNU General Public License, which may be found in the Perl 5 source ki
+t.
Complete documentation for Perl, including FAQ lists, should be found
+on
this system using "man perl" or "perldoc perl". If you have access to
+ the
Internet, point your browser at http://www.perl.org/, the Perl Home Pa
+ge.
> cat tmp.pl
#!/usr/bin/perl
sub mysub {
die 'single word expected' if (my $name = shift) !~ /^\w+$/;
die 'single word expected' if (my $value = shift) !~ /^\w+$/;
}
$str = "abc def";
$str =~ /(\w+)\s+(\w+)/;
mysub($1, $2);
> ./tmp.pl
single word expected at ./tmp.pl line 4.
perlvar says "read-only and dynamically scoped"
$<digits> ($1, $2, ...)
Contains the subpattern from the corresponding set of capturing pa
+rentheses from the last successful pattern match, not counting patter
+ns matched in nested blocks that have been exited already. (Mnemonic:
+ like \digits.) These variables are all read-only and dynamically sco
+ped to the current BLOCK.
I'm confused a bit
have decided to post here