in reply to Re: Capturing the stdout and exit code from a program piped to perl
in thread Capturing the stdout and exit code from a program piped to perl

Laurent_R, on what kind of system did you try the ls | perl command? I ask for impossible to find in ls error message is new to me (have not seen yet on FreeBSD 4.x to 8.4-STABLE, Redhat CentOS 5, 6).

Replies are listed 'Best First'.
Re^3: Capturing the stdout and exit code from a program piped to perl
by Laurent_R (Canon) on Dec 11, 2014 at 12:37 UTC
    Hi, I tried it on Cygwin (linux/bash emulator under Windows) and AIX (IBM's brand of Unix). This is the message under AIX:
    ls foobar.* | perl -E ' $return_code = `echo $?`; say scalar $return +_code;' ls: cannot access foobar.*: A file or directory in the path name does +not exist. 0
    Well, now that I think about it, I translated into English the original message, to make it clearer to the English-speaking reader.