in reply to unreadline function?
my $lpos = tell(DATA); # remember where I was while (<DATA>) { print "$_"; if ($_ =~ /another/) { # if this line has what I want seek DATA, $lpos, 0; # rewind to beginning of line print <DATA>; # and read it again } $lpos = tell(DATA); # save offset to the beginning # of the next line } __DATA__ This is a line This is another line
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: unreadline function?
by Anonymous Monk on Mar 01, 2004 at 04:32 UTC | |
by esskar (Deacon) on Mar 01, 2004 at 04:34 UTC |