my $result=`sudo /bin/mount /dev/fd0 /mnt/floppy`; if ($?) { # there was an non zero return code print "There was an error: $?\n"; print $result } else { # looks like it worked } #### if ($? == -1) { print "failed to execute: $!\n"; } elsif ($? & 127) { printf "child died with signal %d, %s coredump\n", ($? & 127), ($? & 128) ? 'with' : 'without'; } else { printf "child exited with value %d\n", $? >> 8; }