in reply to Passing Array of Arrays (AoA) as a Reference?
In &PrintArray2("@FruitAoA"); you need to drop the quotes.
In my $AoA = @_; this fetches the number of arguments passed in. You probably meant my @AoA= @_;.
Update: OK, I even tested your code and with those two fixes it works. I strongly suggest that from now on you start each of your scripts with:
which would force you to change some things to be more like:#!/usr/bin/perl -w use strict;
or justmy @FruitAoA; push @FruitAoA, [qw(Fruit Apple Red)]; push @FruitAoA, [qw(Fruit Bananna Yellow)]; push @FruitAoA, [qw(Fruit Orange Orange)]; push @FruitAoA, [qw(Fruit Kiwi Green)];
andmy @FruitAoA= [qw(Fruit Apple Red)], [qw(Fruit Bananna Yellow)], [qw(Fruit Orange Orange)], [qw(Fruit Kiwi Green)], );
Doing this will make it much easier for you to spot similar mistakes in the future. - tye (but my friends call me "Tye")for my $i ( 0 .. $#FruitAoA )
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (tye)Re: Passing Array of Arrays (AoA) as a Reference?
by davorg (Chancellor) on Jan 04, 2001 at 00:25 UTC | |
by elpienck1 (Initiate) on Jan 04, 2001 at 03:47 UTC |