Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Counting number of characters in a string

by petral (Curate)
on Mar 15, 2001 at 01:30 UTC ( #64502=note: print w/ replies, xml ) Need Help??


in reply to Counting number of characters in a string

Count the dots using a regular expression:
$str="There's many more ways to do it.\n"; $str =~ tr/\000-\xff/./; while ( $str =~ /(.)/g ) { $count++; }
You can check this using a different method:
$count2++ while chop $str; $count eq $count2 or warn "there's something wrong with this code.\n";


p

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://64502]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2016-08-26 03:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The best thing I ever won in a lottery was:















    Results (365 votes). Check out past polls.