in reply to Multiple Test Regex Does not work the way I expect
See perlop:
m/PATTERN/cgimosx (...) If the PATTERN evaluates to the empty string, the last successfull +y matched regular expression is used instead.
Then, contemplate on what the effects of this (somewhat odd) feature are with your $$hash{"p1"} being empty...
___
P.S.: you'd typically write $s =~ /.../; (i.e. use an explicit pattern delimiter) even though Binding Operators says
If the right argument is an expression rather than a search patter +n, substitution, or transliteration, it is interpreted as a search pattern at run t +ime.
P.P.S.: also note that the dots in a pattern like /19.28.18.28/ are regex metacharacters, so maybe you want to use quotemeta (or rather simply use eq string comparison...?)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Multiple Test Regex Does not work the way I expect
by stunbox (Initiate) on Oct 28, 2009 at 12:47 UTC |