in reply to Empty qr// fails to match -- Is this known bug?
It's no bug, but a feature. Quote from perlop:
m/PATTERN/cgimosx
(...) If the PATTERN evaluates to the empty string, the last successfully matched regular expression is used instead. In this case, only the "g" and "c" flags on the empty pattern is honoured - the other flags are taken from the original pattern. If no match has previously succeeded, this will (silently) act instead as a genuine empty pattern (which will always match).
In this particular case, the last successfully matched regular expression is "(1)(2)". which matches neither "1" (i.e. $t), nor "2" ($u).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Empty qr// fails to match -- Is this known bug? (bug)
by tye (Sage) on Oct 23, 2008 at 13:27 UTC | |
by chibiryuu (Beadle) on Oct 23, 2008 at 15:04 UTC | |
by chromatic (Archbishop) on Oct 23, 2008 at 17:39 UTC | |
by rir (Vicar) on Oct 23, 2008 at 16:23 UTC | |
by chibiryuu (Beadle) on Oct 23, 2008 at 17:11 UTC | |
by rir (Vicar) on Oct 23, 2008 at 20:35 UTC |