in reply to How to get each character in string value
That is: you have a string, you know how long the string is, you should rely on that knowledge. What you did was more C-like than Perl-like.for my $index ( 0 .. length( $string ) - 1 ) { my $a = index( $string, $index, 1 ); # # do something }
|
|---|