use Eight::Ball; open my $file, '>', $filename or die "unable to open $filename"; open my $oldout, '>&', STDOUT or die "unable to dup STDOUT"; my $pid = open STDOUT, '|-'; unless ($pid) { my $ball = Eight::Ball->new(); while (<>) { if ($ball->tell_me("should I redirect the line?")) { print $file $_; } else { print $oldout $_; } } exit(0); } # your code goes here!
In reply to Re: Redirect output
by salva
in thread Redirect output
by arush_pareek
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |