On Mar 28, 2004, at 5:01 PM, Keith P. Boruff wrote: [..]
In other words, how do I get this code:

while(<STDIN>)
{
   print $_ . "\n";
}

not to even loop at all if it has to wait for a human being to enter data?
[..]

actually the simplest trick would be say:
        use IO::Handle;
        my $io = new IO::Handle;
        if ($io->fdopen(fileno(STDIN),"r")) {
                $io->blocking (0);
                 print $io->getline
                        while( !$io->eof );
           $io->close;
        }
        print "past the line\n";

[jeeves: 27:] ./stdio.plx
past the line
[jeeves: 28:] echo "Hello there\
Happy Happy" | ./stdio.plx
Hello there
Happy Happy
past the line
[jeeves: 29:]

HTH.

yes, your old school tie 'c coding tricks'
are mostly what you fill find most useful...


ciao drieux

---


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to