Alejandro Santillan Iturres wrote:

[snip]

$textcomplete="Mary has a little lamb\nMary has a little lamb which is black!"; $i=0;
@textinlines=split(/\n/,$textcomplete);
foreach(@textinlines){
print "$i:$textinlines[$i]\n";
@textinchars=split(//,$textinlines[$i]);
foreach(@textinchars){print "$textinchars[$j]:";$j++;}
$i++;
print "\n";
}
and produces the result: 0:Mary has a little lamb
M:a:r:y: :h:a:s: :a: :l:i:t:t:l:e: :l:a:m:b:
1:Mary has a little lamb which is black!
 :w:h:i:c:h: :i:s: :b:l:a:c:k:!:::::::::::::::::::::::
Instead of: 0:Mary has a little lamb
M:a:r:y: :h:a:s: :a: :l:i:t:t:l:e: :l:a:m:b:
1:Mary has a little lamb which is black!
M:a:r:y: :h:a:s: :a: :l:i:t:t:l:e: :l:a:m:b: :w:h:i:c:h: :i:s: :b:l:a:c:k:!:
Anyone sees the mistake?

Try resetting $j to zero before the start of the inner loop

Rob.
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to