in reply to Re^2: Determing whether a regexp has capturing matches
in thread Determing whether a regexp has capturing matches
Keep in mind that $#+ is -1 when the pattern does not match, regardless of whether there are captures.
"1234" =~ /(1)34/; print $#+, "\n"; "1234" =~ /134/; print $#+, "\n";
That prints "-1" both times, and -1 is considered a "true" value.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Determing whether a regexp has capturing matches
by adrianh (Chancellor) on Feb 27, 2007 at 16:45 UTC |