my $x; $x = system("which perl"); print "-- $x --"; #this will print: /usr/bin/perl # -- 0 --