in reply to ignore first 5 lines of a file
Just for sheer amusement value, here's another way of skipping the first five lines of a file:
while (<>) { do_something($_) if (6..eof()); }
Some explanation is in order. When the range operator .. appears in a scalar context, it becomes the flipflop operator, which behaves very differently and magically. If the argument on either side of it is a constant number, it does an implicit compare with $.. Another way of doing it would be:
while (<>) { next if (1..5); # Whatever here }
stephen
|
---|