in reply to How to find whether an external commands exists

Most unix-style command-line tools have a particular option to allow running the tool without actually doing anything -- e.g. just report the version number of the tool (like 'perl -v').

For tools that don't follow that general rule, you could use $ENV{PATH} to see if a file with a chosen name happens to exist in any of the user's current execution-path directories -- something like:

my $tool_name = "tar"; # simple example my $tool_path = ''; for my $path ( split /:/, $ENV{PATH} ) { if ( -f "$path/$tool_name" && -x _ ) { print "$tool_name found in $path\n"; $tool_path = "$path/$tool_name"; last; } } die "No $tool_name command available\n" unless ( $tool_path );
(updated to include the "tool_path" variable and the "die" statement)

I don't know, but you might need to  split /[;:]/ if you want that to work in the "standard" windows shell as well as on unix(-like) systems.

If you promise to only use a unix-like environment (incl, cygwin or uwin on windows), you could also depend on the "which" command:

my $tool_name = "tar"; my $tool_path = `which $tool_name`; die "No $tool_name command available\n" unless ( $tool_path );

(Another update: D'oh -- I should have known there was a module for this!)