Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
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 sharing their wisdom with the Monastery: (4)
As of 2025-11-16 18:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (72 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.