in reply to accessing array through array reference in hash
I think you need curly braces around $hash{'aref'} to explicitly cast it as an array. (Not sure if my terminology is correct.)
#!/usr/local/bin/perl -w use strict; my @array = ('one','two','three'); my $aref = \@array; my %hash = (); $hash{'aref'} = $aref; print "Array length is:", scalar(@{$hash{'aref'}}), " \n";
Array length is: 3
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: accessing array through array reference in hash
by phaylon (Curate) on Dec 29, 2005 at 00:27 UTC |