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

Re: Running External Commands

by Michalis (Pilgrim)
on Jun 06, 2000 at 16:33 UTC ( #16590=note: print w/ replies, xml ) Need Help??


in reply to Running External Commands

The best way (to my knowledge) to do that is to use backticks, assigning the result to a scalar (the output doesn't have to be a single line, or a single word or anything. For example:

$result=`/bin/tail -15 /var/adm/messages`;
You should be very careful though, if you decide to pass to the command options from the user's input (for example through a CGI script). But that's a fact, either you use backticks or system.


Comment on Re: Running External Commands
Download Code
RE: Re: Running External Commands
by ivey (Beadle) on Jun 06, 2000 at 18:38 UTC
    Since you've almost mentioned taint checking, I figured I'd jump in with a link to a taint checking FAQ.

    CGI/Perl Taint Mode FAQ

    Taint checking, for those that don't know, is how you solve the "be very careful" issue that Michalis mentioned.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (14)
As of 2014-10-21 18:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (106 votes), past polls