home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / perl / scripts-convex / clones / wc.pl < prev    next >
Encoding:
Text File  |  1991-05-11  |  316 b   |  14 lines

  1. $lines++;
  2. $chars += length;
  3. $words += s/\S+//g;
  4. next unless eof;
  5.  
  6. printf " %7d %7d %7d %s\n", $lines, $words, $chars, ($ARGV eq '-'?'':$ARGV);
  7.  
  8. $tlines += $.; 
  9. $twords += $words; 
  10. $tchars += $chars; 
  11. $chars = $words = $lines = 0;
  12.  
  13. printf " %7d %7d %7d %s\n", $tlines, $twords, $tchars, "total" if $files++ && eof();
  14.