Here's another method if you're running perl 5.8.0 or better:
$str = "this is just a test\nthis is another test\nthis is yet another + test\n"; open F, "<", \$str or die; # open a handle to our string $/ = \5; # Read 5 characters at a time while (<F>) { # Read 'em! print "$_\n"; }
In reply to Re: Counting characters in a string
by duff
in thread Counting characters in a string
by TASdvlper
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |