in reply to reset filehandle position on a buffered pipe in
AFAIK seek doesn't work in pipes. Because pipes are not random access but simple FIFOs.
The best option for you would be to implement a buffer yourself. Simple as that:
my @buffer=(); sub read_a_line { if (@buffer) { return shift @buffer; } else { my $x= <PIPE>; return $x; } } sub push_back_line { push @buffer, @_; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: reset filehandle position on a buffered pipe in
by johnvandam (Acolyte) on Nov 03, 2008 at 16:00 UTC |