in reply to Re: Read and skip a line
in thread Read and skip a line
#!/usr/bin/perl -w use strict; open (FILE, '<', shift); my @file = <FILE>; close (FILE); my $first = shift @file; foreach my $line (@file) { chomp $line; for (my $i = 1; $i <= $first; $i++) { print "Line $i: $line\n"; } }
Original content restored above by GrandFather
Ok sweet, I've got it to work your way, and I used the next and shift functions instead of giving a value through $line[0] :D
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Read and skip a line
by NetWallah (Canon) on Apr 15, 2012 at 21:34 UTC |