We don't bite newbies here... much | |
PerlMonks |
Stream and Atom flexibilityby seedstitch (Initiate) |
on Mar 15, 2008 at 00:28 UTC ( [id://674323]=perlquestion: print w/replies, xml ) | Need Help?? |
seedstitch has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks:
This seems so simple, yet I've not found a clue in the O'Reilly book nor an extensive library of scripts at my disposal: I need to process either a stream of millions of data points or a single atom with the same script: > cat stream | foo > foo bar (where bar is a single element form the stream) I'm using the following convenient method to processing a stream from STDIN:
while (<>){ if ($ARGV[0]) {$inline = $ARGV[0]}
do{ Course, now perl thinks $ARGV[0] is a file for input, and if I delete @ARGV, perl now waits patiently on STDIN. I need to be able to disable STDIN when an invocation argument is suppplied. Is that possible? thanks!
Back to
Seekers of Perl Wisdom
|
|