Make that "or else the Regex engine may consider it
an array". This is actually one of the more magical parts
of Perl parsing. Consider:
#!/usr/bin/perl -w
use strict;
my $m= 'aeiou';
my @m= qw( a e i o u );
my $at= 'tye@perlmonks';
my $dollar= 'tye$perlmons';
sub Try {
local( $" )= ",";
print "(@_)\n";
}
Try $at =~ /[@m]+/g;
Try $at =~ /[m@]+/g;
Try $dollar =~ /[$m]+/g;
Try $dollar =~ /[m$]+/g;
__END__
Outputs:
(e,e,o)
(@,m)
(e,e,o)
/[m5.006+/: unmatched [] in regexp at reinterp.pl line 12.
The "rules" that control this defy simple explanation so
I'll just refer you to the source code. Simply search for
"weight" in the Perl source code (it is only ever mentioned
in the code for this parsing which is located in the file
toke.c).
-
tye
(but my friends call me "Tye") |