|
There are lots of ways...here's one off the cuff
my $linecount = 0;
open FILE,"<file.txt" || die "Unable to open file: $!";
my @lines = <FILE>;
close(FILE);
my $line;
foreach $line(@lines) {
$linecount++;
while ($linecount<2) {
print "$line";
}
}
should work in most contexts.
|