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

Shouldn't that be s/./+1/gs;
  • Comment on Re: Re: Counting number of characters in a string

Replies are listed 'Best First'.
Re: Re: Re: Counting number of characters in a string
by t0mas (Priest) on Mar 13, 2001 at 14:22 UTC
    $_="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