in reply to syntax error

It should be =~ (= and then ~).

Replies are listed 'Best First'.
Re^2: syntax error
by bart (Canon) on Aug 19, 2007 at 20:02 UTC
    = and then ~
    but don't put any whitespace between the two characters, because that's valid too, and means something entirely different! = is plain assignment and ~ is the unary bitwise not operator. So it would mean:
    $_ is assigned the value of bitwise not the value of (whatever expression, in this case, how many times did the match succeed?)
      Ahhggg. I was trying to help the OP avoid an easily missed mistake, that's why I spelled it out.

      You're quite right, of course.

A reply falls below the community's threshold of quality. You may see it by logging in.