http://www.perlmonks.org?node_id=64101


in reply to Re: Re: Counting number of characters in a string
in thread Counting number of characters in a string

$_="YASWOCCIAS"; don't contain any newlines so it doesn't matter in this case. In other cases it might, depending on how you define "character" in your application. For some apps (like word processors), s/\S/+1/g; might be the right choise if you like to use this algorithm in your production environment... :-)

/brother t0mas
  • Comment on Re: Re: Re: Counting number of characters in a string