- or download this
perl -pi.bak -e '$count++;s/^/$count. /' file_name
- or download this
foreach my $line (@file) {
(undef) = <FILE>; # stores number of lines into $.
...
print FILE, "$count. ";
if ($count == $.) {last; }
}
- or download this
foreach my $line (@file) {
$count++;
print FILE, "$count. $line";
}
- or download this
foreach (@file) {
$count++;
s/^/$count. /;
print FILE;
}
- or download this
(undef) = <FILE>; # stores number of lines into $.
- or download this
if ($count == $.) {last; }