Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: ppk

by northwind (Hermit)
on Apr 19, 2005 at 08:23 UTC ( [id://449144]=note: print w/replies, xml ) Need Help??


in reply to ppk

I'm mildly suprised that no-one caught the problem in the following line:
  $process = qr/\s+(?:\d+[:])+?\d+\s+.*?$ARGV[0].*?\s*$/;

Because I'm using user input in a regexp, I should have done one of the following:

# use \Q and \E $process = qr/\s+(?:\d+[:])+?\d+\s+.*?\Q$ARGV[0]\E.*?\s*$/; # or enclose in an eval eval { $process = qr/\s+(?:\d+[:])+?\d+\s+.*?$ARGV[0].*?\s*$/; }; if($@) { ... }
I chose to go with the eval { ... } version mainly because I actually want regexp functionality on the command line.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (6)
As of 2024-04-19 06:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found