##
/usr/bin/mycommand < file
####
my $cmd = "/usr/bin/mycommand < file";
if ( system $cmd ) {
warn $cmd .
($? == -1)
? " failed to execute: $!\n"
: ($? & 127)
? sprintf "child died with signal %d, %s coredump\n",
($? & 127),
($? & 128)
? 'with'
: 'without'
: sprintf "child exited with value %d\n", $? >> 8;
}