in reply to Re: Capture error from one-liner
in thread Capture error from one-liner

Perl with -p doesn't die if a file doesn't exist

Right you are; a workaround is

qwurx [shmem] ~ > perl -p -e 'BEGIN{$SIG{__WARN__}=sub{die@_}}' nonexi +stent Can't open nonexistent: No such file or directory. qwurx [shmem] ~ > echo $? 2
perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Replies are listed 'Best First'.
Re^3: Capture error from one-liner
by choroba (Cardinal) on Sep 19, 2014 at 16:56 UTC
    Well, my one-liners are usually not warning-proof...
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ