> I am trying to make a two dimentional array. I have a 
> function that returns an array. The following code works:
> 
> @x = f();
> push(@y, \@x);
> 
> and then I can reference it @{@y[$i]}[$j};
> 
> Is this the best way to make two dimentional arrays; I.e., 
> using push and reference to arrays?
> 
> Also, I was wondering if I can construct the array without a 
> variable x. I tried: push(@y, \f()); push(@y, \@{f()}); The 
> second line does something but not what I intended to do.
> 
> Can I make a two dimentional array without using the variable x?

Yes, you can create it by assigning something to it, i.e.

$y[0][0] = 'whatever';

Or, in a loop:

for my $o (1..20) {
  for my $i (1..5) {
    $y[$o][$i] = 'whatever';
  }
}

Hope that helps a bit,

 -dave



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to