in reply to What is wrong in this

or :

$a =~ m/\d\d\.\d\d||\$\d\d\d\.\d\d\d||\$\.\d\d/;

Replies are listed 'Best First'.
Re^2: What is wrong in this
by fishbot_v2 (Chaplain) on Nov 24, 2005 at 18:43 UTC

    Alternations in regexen are a single pipe, not a double pipe. Your version has two null alternations, and will thus match the empty string, and since it isn't anchored, anything:

    $ perl -le 'print "foo" if "zoombots" =~ m/baz||bar/' foo