Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: pattern match -vs- *ix grep

by VSarkiss (Monsignor)
on Apr 07, 2005 at 14:07 UTC ( [id://445675]=note: print w/replies, xml ) Need Help??


in reply to pattern match -vs- *ix grep

Can anyone tell me of a better way to do this?
Yes. Check your arguments. This little snippet could cause havoc if called with
$ snippet.pl '| rm -rf *' 'ouch'
Take a look at Two-arg open() considered dangerous for details.

My point is that specialized utilities that have been around for a long time, like grep, have more than speed going for them. In general, they'll handle edge cases better.

If you want to demonstrate "the power of Perl", remember that power can be used for good or evil. :-)

Replies are listed 'Best First'.
Re^2: pattern match -vs- *ix grep
by Anonymous Monk on Apr 07, 2005 at 14:29 UTC
    Sillyness. Anyone typing in
    $ snippet.pl '| rm -rf *' 'ouch'
    could as well have typed
    $ rm -rf *
    No point in checking the arguments.

Log In?
Username:
Password:

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

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

    No recent polls found