I want to read from a pipe in my perl script invoked like:

date | perl myperlscript.pl

I understand that this puts the text outputted from the date program
into the stdin. How could I check the buffer contained by the stdin
without it blocking for you to input anything from the keyboard if
nothing was piped in to the command.

my perlscript contains something like:

#this part im unsure about so im using functions that dont exist
if(buffer_has_stuff_in_it(STDIN)){
    while(<STDIN>){
        print "$_\n";
    }
}
else{
    print "You didnt pipe anything into this program!\n";
}

I dont want this to accept anything from the keyboard if theres not
anything in the STDIN buffer.

Thanks


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


Reply via email to