Counting the # of characters in a multi-line string



I've been taking little baby steps on understanding how to read
multi-line strings as some of you have been seeing in the past week or
so. I've been posting the [DOT multiline strings].

My next goal is to count the total nunber of characters in a string and
the number of chomps that I did.

Code:

while(<IN>)
{
chomp ();
$DOTct = length ($_);
print "$DOTct\n";

last if /.*\]/;
}

What I'm producing is a character count per $_.
Output ex:
4
4
4

What I'm trying to do is total the count and get 12. Do I need to set
a line counter to 0 and increment from $_?

Also, is there a way to count the number of chomps that was done during
the read?

Thank you,
Mike

.



Relevant Pages

  • Re: Counting the # of characters in a multi-line string
    ... I've been posting the [DOT multiline strings]. ... My next goal is to count the total nunber of characters in a string and ... is there a way to count the number of chomps that was done during ... complete script which shows us what you have tried. ...
    (perl.beginners)
  • Re: Counting the # of characters in a multi-line string
    ... I've been posting the [DOT multiline strings]. ... My next goal is to count the total nunber of characters in a string and ... is there a way to count the number of chomps that was done during ...
    (perl.beginners)
  • Re: Why R6RS is controversial
    ... the semantics of the language, ... behavior of grapheme-cluster characters under most linguistic ... as the strings grow longer. ... Normalization is hideously complicated, and may require many ...
    (comp.lang.scheme)
  • Re: Unicode LISP??
    ... I'm not experienced with Common Lisp library, ... terms of strings rather than characters. ... have their representation upgraded if they are updated in place. ...
    (comp.lang.lisp)
  • Re: not quite 1252
    ... The kill_gremlins function is intended to fix Unicode strings that have been obtained by decoding 8-bit strings using 'latin1' instead of 'cp1252'. ... In fact it wasn't, it was UTF-8 like Sergei wrote, but it was easy to convert it to cp1252, no problem. ... characters to documents marked up as ISO 8859-1 or other encodings. ...
    (comp.lang.python)