azredwing has asked for the wisdom of the Perl Monks concerning the following question:
I wrote a program for work (I'm an undergraduate intern who taught himself Perl in about 3 weeks) that basically generates a giant report and dumps it to the terminal. It works great, but I'd like people to be able to pipe it to either dump to a file or use the "more" command, as in these examples:
I can easily implement either of these features from within the program, but I'd like to be able to this to make the program more "UNIX-like". I don't want to make people learn some new switch/flag/whatever when it's possible to use the UNIX pipes, especially if people want to use "cat", "lpr" or "grep", etc.$ my_program > w00t.txt $ my_program | more
I'm not going to post the code here; it's pretty long, irrelevant to the question, and essentially the print to STDOUT happens within the last 5 lines.
So, how do I pipe my output to, say, "more"?
Thanks for all the help!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How do I pipe the output of a Perl program to something else?
by kyle (Abbot) on Feb 14, 2008 at 03:57 UTC | |
by azredwing (Sexton) on Feb 14, 2008 at 05:56 UTC | |
by graff (Chancellor) on Feb 14, 2008 at 06:47 UTC | |
by azredwing (Sexton) on Feb 14, 2008 at 07:00 UTC | |
by kyle (Abbot) on Feb 14, 2008 at 19:12 UTC | |
|
Re: How do I pipe the output of a Perl program to something else?
by cdarke (Prior) on Feb 14, 2008 at 14:39 UTC |