in reply to Re: 'Transparent grep'
in thread 'Transparent grep'

$? = ...; doesn't set the exit code.

Works for me:

perl -e 'END{$?=1}' && echo foo # prints nothing perl -e 'END{$?=0}' && echo foo # prints "foo"

You can manipulate $? in an END block.  From perlmod:

Inside an "END" code block, $? contains the value that the program is going to pass to "exit()". You can modify $? to change the exit value of the program.

Replies are listed 'Best First'.
Re^3: 'Transparent grep'
by ikegami (Patriarch) on Feb 26, 2009 at 23:33 UTC

    doh, I tested it outside of END.

    And I now see he wants to print every line.

    Just ignore my post!