That's what I thought but I couldn't seem to get it to work. I am going to
go try it again. I am betting I had a typo somewhere when I what seemed to
be the proper way. 
I DO read the warnings and errors and look at what line number the parser
pukes on. . .

Thanks Brett.

Robb



-----Original Message-----
From: Brett W. McCoy [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 30, 2001 10:59 AM
To: Robb Wagoner
Cc: [EMAIL PROTECTED]
Subject: Re: reference to a two dimensional array


On Mon, 30 Jul 2001, Robb Wagoner wrote:

> I have a two dimensional array where each element consists of a reference
to
> an anonymous array.
>
>       push(@array,[$var1,$var2,$var3]);
>
> When I pass a reference to the array in a subroutine:
>
>       some_sub(\@array);
>
> What is the proper way to dereference the array with in the subroutine?
>
> After much monkeying I was able to get this to work:
>
>       @{$_}->[0][0]

No need to monkey around, this is well documented in the perlref POD.

some_sub(\@array);

sub some_sub {

  my $arr = shift;

  my $var = $arr->[0][0];

  # etc etc etc
}

-- Brett

Brett W. McCoy
Software Engineer
Broadsoft, Inc.
240-364-5225
[EMAIL PROTECTED]

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

Reply via email to