Aaaargh!
How do I downvote / borg myself?
However (conveniently bypassing the requirement for names beginning with __):
#!/usr/bin/perl
use warnings;
use strict;
# 744661
my @var = ( 'foo.Bar',
'for.bar',
);
for my $var(@var) {
print "Before regex, \$var: $var \n";
if ( $var =~ /^([-!#.0-9@-Z_a-z]+)$/ ) {
print "\$var: $var\n";
} else {
print "no match!\n";
}
}
produces:
Before regex, $var: foo.Bar
no match!
Before regex, $var: for.bar
$var: for.bar
whereas using /i in the regex at line 12:
Before regex, $var: foo.Bar
$var: foo.Bar
Before regex, $var: for.bar
$var: for.bar
leaving me to wonder about the "shorthand." |