in reply to saving search results to file
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
|
|---|