in reply to Modify system() call output only if printed to STDERR

Sounds like a job for IPC::Run3 to me.

Addendum: See also the FAQ

  • Comment on Re: Modify system() call output only if printed to STDERR

Replies are listed 'Best First'.
Re^2: Modify system() call output only if printed to STDERR
by nysus (Parson) on Jan 24, 2018 at 17:14 UTC

    Perfect. Got it with:

    run3 ['lpass', $cmd, $args], undef, undef, \&_filter; sub _filter { my $output = shift; $output =~ s/lpass/lpp/gm; print $output; }

    What the hell will they think of next. :)

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest";
    $nysus = $PM . ' ' . $MCF;
    Click here if you love Perl Monks