Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: put system(); output into my $variable -- chech for installed aplications

by Corion (Patriarch)
on Jan 15, 2009 at 12:59 UTC ( [id://736538]=note: print w/replies, xml ) Need Help??


in reply to put system(); output into my $variable -- chech for installed aplications

See system for why your code returns 0.

The which program does not exist on Windows, so your idea won't work anyway. But the easiest way to get the output of a subprocess is to call it using backticks `...` or qx(). See perlop on both.

If you want to find programs on the path, you will need to use File::Spec to split up the path into its parts and then check whether a file (possibly amended by [doc://Config]::Config::_exe) exists in that location, and is executable. See, again, perlop about the -X operators.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-03-29 14:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found