Fair point. The example is not the best I've ever written.
The point is that the empty regex behaviour is useful for allowing you to use m/.../ and then later s//.../ without having to match a second time. Maybe this is better
if ($foo and /bar/) { print "Condition suceeds.\n"; if ($bloop and /bop/) { #... } # do other stuff, maybe even exit... s//baz/; # switch bar or bop with baz depending # on a bunch of things that have already happened. }
Hopefully now you see the point? Sure we could probably rework the logic so this isnt needed, but I like the possibilities this opens up. :-)
First they ignore you, then they laugh at you, then they fight you, then you win.
-- Gandhi
In reply to Re: Re^3: a word of warning about /$pattern/
by demerphq
in thread a word of warning about /$pattern/
by dada
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |