Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Command Line Arg contains Variable and more

by gman (Friar)
on Dec 11, 2009 at 21:13 UTC ( [id://812441]=note: print w/replies, xml ) Need Help??


in reply to Command Line Arg contains Variable and more

Not sure this will work in every arg passed

Also, doing something like this is probably not the safest

#!/usr/bin/perl use warnings; use strict; my $string = $ARGV[0]; #print "$string"; my $rc = `$string`; print $rc;

Replies are listed 'Best First'.
Re^2: Command Line Arg contains Variable and more
by ikegami (Patriarch) on Dec 11, 2009 at 21:57 UTC
    Changing
    system $cmd;
    to
    print `$cmd`;
    is never a good idea. All it does is introduce memory overhead and lag. It definitely doesn't help the OP interpolate a Perl variable into a shell command.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2024-03-28 21:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found