in reply to Testing <>
You can detect the presence of waiting input using select, like:
use strict; use warnings; my $vector = ''; vec($vector,fileno(STDIN),1) = 1; if (select($vector,undef,undef,0.01)) { while (<>) { print; } }
where I have set a 10 millisecond timeout. Might be easier and more portable though to simply pass the filename as argument, and open it yourself. Like many other unix command line tools.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Testing <>
by Anonymous Monk on Oct 03, 2011 at 15:35 UTC |
In Section
Seekers of Perl Wisdom