use strict; use warnings; my $cmd = '/usr/well561/bin/well.newlogfile'; -f $cmd or die "error: '$cmd' not found"; -x $cmd or die "error: '$cmd' not executable"; my $out = `$cmd 1`; my $rc = $? >> 8; print "command exit code is $rc\n"; $rc == 0 or warn "warning: command returned $rc\n"; chomp $out; # remove trailing new line from command output print "command output:$out:\n"; if ($out eq 'Y') { print "command returned Y\n"; }