Skipping the header in a for loop (implied with a statement modifier) is quite flexible as you can skip one, two or many lines with equal facility. It also has the advantage that the scalar receiving the readline only exists within the loop.
my $discard = <$fh> for 1 .. 1; # $discard no longer in scope here.
I hope this is of interest.
Cheers,
JohnGG
Update: Fixed typo.
Update 2: ikegami has pointed out that this code is invalid and explained why so don't do this.
In reply to Re: skipping the first line of a file
by johngg
in thread skipping the first line of a file
by Angharad
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |