in reply to Referncing a local array outside

you could ditch the temporary variable altogether..

#!/usr/bin/perl use strict; my %alink; # Create some arrays of random numbers... foreach my $name ('Fred', 'Barney', 'Wilma', 'Peggy'){ for (my $i = 0; $i < 5; $i++){ push( @{$alink{$name}}, int(rand(30)) ); } } foreach my $key (keys %alink){ foreach my $element ( @{$alink{$key}} ){ print $key,' ',$element,"\n"; } }

(also added 'use strict;' and then 'my' declarations as required.)

cheers,

J