Call it like:sub isExe { my $exe = shift; my @paths = split /;/, $ENV{PATH}; foreach my $path (@paths) { return 1 if -x $path/$exe; } return 0; }
if (isExe("tail.exe")) { print "tail.exe is in my PATH.\n" }
In reply to Re: Verifiying an external program exists
by Paladin
in thread Verifiying an external program exists
by ibanix
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |