***This is not an RE***. You need m"this" syntax to make it an RE. The only time you can not use m is if you have syntax $foo =~ /this/ Using the / char as the RE delimiter makes the m implicit. Your 'RE' uses " as the delimiter so needs the m. It does not do what I expect the original programmer thought it would. Here is what it does:
use warnings; my %flows = ( '0' => 1, '00' => 2, '0$' => 3, '0$more' => 4, 'foo0$' = +> 5 ); foreach (keys %flows) { # loop through keys of %flows setting $_ to each key in turn if (!($_ =~ "^0\$")) { print "Orig $_ not matched\n"; } else { print "Orig $_ matched\n"; } if (!($_ =~ m"^0\$")) { print "RE $_ not matched\n"; } else { print "RE $_ matched\n"; } print $/; } __DATA__ Orig 0 matched RE 0 not matched Orig 00 not matched RE 00 not matched Orig 0$more not matched RE 0$more matched Orig 0$ not matched RE 0$ matched Orig foo0$ not matched RE foo0$ not matched
I am intrigued it is not a syntax error or warning. It appears that the intent is to do something if the hash key does not start with the 2 literal chars '0$'. It does not do that as you can see.
cheers
tachyon
In reply to Re: what function of this Regular Expression?
by tachyon
in thread what function of this Regular Expression?
by iwanthome
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |