blob: 3ba49304931f9a1252caf75f7c24195c978fa99c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#!/usr/bin/perl
use warnings;
use strict;
use File::Basename;
use Getopt::Std;
my %opt;
getopts("hm:", \%opt);
if (@ARGV == 0 || $opt{h}) {
print "usage: ", basename($0), " [options] file(s)...\n\n";
print "Options:\n";
print " -m NUMBER maximum chars tolerated per line (default: 80)\n";
print " -h this help\n";
exit 0;
}
my $max = 80;
my $line = 0;
$max = $opt{m} if ($opt{m});
for my $file (@ARGV) {
open FILE,"<", $file;
$line = 0;
while (<FILE>) {
$line++;
if (length > $max) {
print "\"$file\" - line $line: ", length, " chars\n";
}
}
}
|