[Brisbane-pm] Passing a Two-Dimensional Array to a sub in Perl 5.8.6

Damian James djames at thehub.com.au
Thu Feb 22 18:31:48 PST 2007


On 23/02/2007, at 12:19 PM, Jacinta Richardson wrote:

> sub test (\@) {
>         my ($a) = @_;
>         my @rain = @{$a->[5]};
> ...
> Unfortunately this works perfectly.  @rain appears to be getting  
> full access to
> what we defined in @array as expected.  So I must have missed  
> something from
> what you wrote.  The same effect can be achieved without prototypes  
> as follows:

What you missed was that Martin didn't dereference $a correctly:

On 22/02/2007, at 8:45 AM, Martin Jacobs wrote:
> 	my @Rain_series = @$a[5]

It's not needing the explicit @{}, it's that the -> is missing

Cheers,
Damian


More information about the Brisbane-pm mailing list