in reply to error messages

Check out the perl faqs which specifically address this situation.

perldoc -f system

It lists how to inspect the return value from a system call.

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; }

Modify to suit.

Replies are listed 'Best First'.
Re^2: error messages
by Jaap (Curate) on May 13, 2005 at 15:28 UTC
    Excellent answer. Just to be complete, this is the short version:
    system("/my/shell/prog") && die "System failed: $!"