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 )
In reply to (tye)Re: Passing Array of Arrays (AoA) as a Reference?
by tye
in thread Passing Array of Arrays (AoA) as a Reference?
by elpienck1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |