in reply to Re: Using eval to build array structure
in thread Using eval to build array structure

I agree with both Tye and dragonchild. However, I have just a little nit with both of their sample codes. The Range for the $i subsrcript should be 0 .. 4 since perl arrays are zero indexed.

so,

for my $i (1 .. 4) {
should be
for my $i (0 .. 4) {

and,

for $j($i+1..5){
should be
for $j($i+1..4){

-meta4

Replies are listed 'Best First'.
Re: Re(2): Using eval to build array structure
by Popcorn Dave (Abbot) on Jul 17, 2002 at 18:17 UTC
    I would agree with you, yes, that arrays do start from 0 in Perl. However what I was originally trying to do was to get @array1, @array2, etc. build using the loop index. Since my arrays were numbered 1-5, they are correct in their examples ( at least for my problem ).

    Some people fall from grace. I prefer a running start...