#!/usr/bin/perl use warnings; use strict; use File::Basename; use Getopt::Std; use Text::Tabs; my %opt; getopts("hm:t:", \%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 " -t NUMBER count \\t as NUMBER chars (default: 4)\n"; print " -h this help\n"; exit 0; } my $max = 80; my $line = 0; $Text::Tabs::tabstop = 4; $max = $opt{m} if ($opt{m}); $Text::Tabs::tabstop = $opt{t} if ($opt{t}); for my $file (@ARGV) { open FILE,"<", $file; $line = 0; while () { $line++; $_ = expand $_; if (length > $max) { print "\"$file\" - line $line: ", length, " chars\n"; } } }