in reply to Regex being stupid

In addition to what others have pointed out, the '@' in the regex needs escaping. @( is a valid variable name in perl (that happens to have zero elements in it normally).

Dave.

Replies are listed 'Best First'.
Re^2: Regex being stupid
by Grimy (Pilgrim) on Sep 19, 2013 at 08:53 UTC
    While it is true that @( is a valid variable name, it doesn’t interpolate:
    @( = (42, 12); # valid statement print "@("; # doesn’t print '4212' but '@(' print '@('; # same as above (obviously)
    Thus, the @ in the regex doesn’t need escaping, strictly speaking. I’d still recommend escaping it, for clarity and maintainability.