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

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

by Corion (Pope)
on Jan 15, 2009 at 12:59 UTC ( #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?

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2020-08-13 18:23 GMT
Find Nodes?
    Voting Booth?
    Which rocket would you take to Mars?

    Results (74 votes). Check out past polls.