Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Regex being stupid

by dave_the_m (Monsignor)
on Sep 19, 2013 at 07:21 UTC ( [id://1054789]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1054789]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-18 02:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found