#!/usr/bin/env perl # # loo - lines of ode - counts lines and chars without surrounding whitespace # # $Id$ use strict; use warnings; use Getopt::Std; my %opt; getopts( 'htw', \%opt ); if ( $opt{'h'} ) { print STDERR <) { chomp; if ( /\S.*\S/ || /\S/ ) { $nrchars += length($&); $nrlines += 1; } elsif ( $opt{'w'} ) { $nrlines += 1; } } close(IN); print "$nrlines\t$nrchars\t$f\n"; $totalchars += $nrchars; $totallines += $nrlines; } if ( $opt{'t'} ) { print "$totallines\t$totalchars\ttotal\n"; }