in reply to Capture error from one-liner

This is not specific to korn shell. Perl with -p doesn't die if a file doesn't exist (cf. the behaviour of open). Unfortunately, autodie doesn't help here, so if you want it to die, you have to change the logic to something like
| V perl -e 'for my $file (@ARGV) { open my $IN, "<", $file or die $!; whi +le (<$IN>) {s/AJZ/AZZ/g if /^AB/; print}}' input > output
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: Capture error from one-liner
by shmem (Chancellor) on Sep 19, 2014 at 16:54 UTC
    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'
      Well, my one-liners are usually not warning-proof...
      لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
Re^2: Capture error from one-liner
by LanX (Saint) on Sep 19, 2014 at 17:03 UTC
    But wait the OP showed us an error displayed on the console!

    Maybe -i is producing it?

    Cheers Rolf

    (addicted to the Perl Programming Language and ☆☆☆☆ :)

Re^2: Capture error from one-liner
by dirtdog (Monk) on Sep 19, 2014 at 16:48 UTC

    thanks for the help

    I'll pipe the command to a log and grep for errors.