Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^5: perl eval

by johngg (Canon)
on Jul 05, 2010 at 19:34 UTC ( [id://848113]=note: print w/replies, xml ) Need Help??


in reply to Re^4: perl eval
in thread perl eval

and I just want to evaluate whatever is there in the parameter

That might end in tears!

use strict; use warnings; my $param = shift; eval $param; die $@ if $@;

Let's see some files.

$ perl spw848064 'system ls' reallyImportant.data spw848064 $

You can see what's coming :-)

$ perl spw848064 'system qw{rm -f reallyImportant.data}' $

Oops!

<!--$ perl spw848064 'system ls' spw848064 $

It might be worth doing a little sanity checking before evaling willy-nilly.

Cheers,

JohnGG

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-04-24 21:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found