Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^4: perl eval

by paribasu (Initiate)
on Jul 05, 2010 at 18:59 UTC ( [id://848105]=note: print w/replies, xml ) Need Help??


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

I dont want to call egal from the script itself. The name of the sub is coming through parameter and I just want to evaluate whatever is there in the parameter.

Replies are listed 'Best First'.
Re^5: perl eval
by johngg (Canon) on Jul 05, 2010 at 19:34 UTC
    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://848105]
help
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found