in reply to How To Do This Better?
if you are sucking from file, try this one:
which will count letters ( okay, it will include underscores and numbers too ). Remove the substitution for a character count. For exactly letters, use:$/ = undef; $line = <FILE>; close FILE; $line =~ s/\W+//g; print "I found ", length( $line ), "characters in the file\n";
Just another way to do it,$line =~ s/[^a-zA-Z]+//g;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: How To Do This Better?
by chromatic (Archbishop) on Apr 15, 2000 at 01:36 UTC |