> Is this the best way to make two dimentional arrays...
> ...and then I can reference it @{@y[$i]}[$j};
That is a little icky. You can access individual elements like this:
$y[0]->[1]
....Or
$y[0][1]
> I was wondering if I can construct the array without a variable x.
> I tried:
> push(@y, \f());
> push(@y, \@{f()});
This should work:
push(@y, [f()] );
Check out "perldoc perlreftut" it explains all this in a simple way... and
since you seem to understand the concept of references already it will be
very easy reading.
Rob
-----Original Message-----
From: FORGHANI,BEHDAD (A-Spokane,ex1)
[mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 4:13 PM
To: [EMAIL PROTECTED]
Subject: Newbie reference question
Hello,
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?
Best Regards,
Behdad Forghani
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]