SuzuBell has asked for the wisdom of the Perl Monks concerning the following question:
But, can I update this code so that there is a second loop for each $char and $string between incrementation of an integer variable, say j? For instance:for my $i ( 0 .. $lengthString - 1 ) { my $char0 = substr( $string0, $i, 1 ); my $char1 = substr( $string1, $i, 1 ); my $char2 = substr( $string2, $i, 1 ); my $char3 = substr( $string3, $i, 1 ); } }
for my $i ( 0 .. $lengthString - 1 ) { for my $j (0 .. $numChars - 1){ // The following line does not work my $char$j = substr( $string$j, $i, 1 ); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Interpolate variable name in Perl?
by Eily (Monsignor) on Oct 24, 2013 at 16:07 UTC | |
|
Re: Interpolate variable name in Perl?
by Kenosis (Priest) on Oct 24, 2013 at 16:25 UTC | |
|
Re: Interpolate variable name in Perl?
by Marshall (Canon) on Oct 24, 2013 at 22:14 UTC |