... my @firstLine = <>; my @dates = split m{\|}, $firstLine; ... while ( my $line = <> ) { ... }