in reply to Re^2: when reading a file how to print a line one above the current line??
in thread when reading a file how to print a line one above the current line??
This way doesn't have the overhead of testing every time whether $prevline is defined. Or you could initialize it to "BOF\n" for a more explicit indication of what's going on.my $prevline = ''; ... print $. - 1, ": $prevline";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: when reading a file how to print a line one above the current line??
by Aristotle (Chancellor) on Jun 05, 2002 at 06:06 UTC |