I have a following code, where i use a command which is used as input for file open.
when my command $cmd gives non-zero exit status my script exits. i want it to still continue and do rest of the things in the script
$cmd = 'ps -u psharma';
open( my $fh, "-|",$cmd ) || die( "$cmd failed: $!" );
my @lines = <$fh>;
close($fh) || die $! ? "Close for $cmd failed: $!" : "Exit status $? from command $cmd";