programming-examples/perl/File/Numbering Lines in Multiple Files.pl
2019-11-15 12:59:38 +01:00

15 lines
259 B
Perl

#!/usr/bin/perl
use warnings;
use strict;
my $lineno;
my $current = "";
while (<>) {
if ($current ne $ARGV) {
$current = $ARGV;
print "\n\t\tFile: $ARGV\n\n";
$lineno=1;
}
print $lineno++;
print ": $_";
}