in reply to Write code using less lines
Another way, also without modification of the original string, perhaps slightly faster:
>perl -wMstrict -le "my $str = 'ABC---DR----EEEEEGGGG-GRE-RED----KKKK---'; print qq{'$str'}; my $len = $str =~ tr/A-Za-z//; print qq{'$str'}; print $len; " 'ABC---DR----EEEEEGGGG-GRE-RED----KKKK---' 'ABC---DR----EEEEEGGGG-GRE-RED----KKKK---' 24
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Write code using less lines
by johngg (Canon) on Apr 19, 2010 at 18:54 UTC |