QM’s approach is probably the best way to go. But, for completeness: another option is to use tee from the command line. The tee command allows standard output to go to the terminal as usual, while also copying it to one or more files:
perl program.pl | tee -a output.txt
Notes:
or its equivalent near the top of the Perl script to force a flush after every print statement (otherwise, you won’t see the Enter file name: prompt).$| = 1;
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re^5: Perl code for finding shortest path not working on large files (chomp)
by Athanasius
in thread Perl code for finding shortest path not working on large files
by zing
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |