Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!texsun!convex!news From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.lang.perl Subject: Re: wc clone Message-ID: <1990Dec21.110952.27897@convex.com> Date: 21 Dec 90 11:09:52 GMT References: <1990Dec20.003805.8017@convex.com> <1990Dec20.020632.10077@convex.com> <1990Dec20.193625.662@convex.com> Sender: news@convex.com (news access account) Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 16 Nntp-Posting-Host: pixel.convex.com Shorter stil: 0 #!/usr/bin/perl -n 1 $chars += length, $words += s/\S+//eg, next unless eof; 2 printf "%8d %8d %8d %s\n", $., $words, $chars, ($ARGV eq '-'?'':$ARGV); 3 $tlines += $.; $twords += $words; $tchars += $chars;reset 'wc'; $. = 0; 4 printf "%8d %8d %8d %s\n", $tlines, $twords, $tchars, "total" if $files++ && eof(); Thanks to Randal for squishing up the last few lines. --tom -- Tom Christiansen tchrist@convex.com convex!tchrist "With a kernel dive, all things are possible, but it sure makes it hard to look at yourself in the mirror the next morning." -me