I wouldn't call this "better", but you may be able to pipe the output through "tee" to send it to both file and STDOUT with a single print statement, if that's what you want. E.g.:
% perl -e 'open FOO, "| tee baz.txt"; print FOO "hiya\n"; close FOO' hiya % cat baz.txt hiya
the lowliest monk
In reply to Re: saving search results to file
by tlm
in thread saving search results to file
by tcf03
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |