Hi guys, I've loaded a file, and have removed the \n using chomp. however, when I try using length($file), it counts the whitespaces along with the characters. How do I just count the characters, anything but the whitespaces?
thanks
Hi guys, I've loaded a file, and have removed the \n using chomp. however, when I try using length($file), it counts the whitespaces along with the characters. How do I just count the characters, anything but the whitespaces?
thanks
Changed SPAN settings in sig a YEAR after it was removed
$str = "place the string you want to count in here";
$count = $str =~ s/([a-z])/$1/gi;
print $count;
Last edited by 99shassan; 04-24-2008 at 06:32 PM. Reason: Automerged Doublepost
Changed SPAN settings in sig a YEAR after it was removed
$count = tr/a-zA-Z//;
perl -e "$_= 'blah blDh'; $count = tr/a-zA-Z//; print $count;"
perldoc perlop
or perl -e "$_= 'blah blDh'; print $count = tr/a-zA-Z//;"
Last edited by paleywiener; 04-25-2008 at 02:57 PM. Reason: Automerged Doublepost
Bookmarks