in reply to A dereferencing problem

I couldn't quite get your code working the way you describe it. I may be missing some point in your program's process. However, assuming your data structure is a hash of arrays (HoA) and you are trying to recover the values from the arrays. Here is what I came up with.
# Compiler directives and Includes use strict; use warnings; use diagnostics; # Global declarations; # Constants and pragmas use constant TRUE => scalar 1; use constant FALSE => scalar 0; ###########################################################; #main() { my $value1 = 0; my $value2 = 0; my $ref = RtnRef(); my $key = ''; # this line will rtn both the key and the value from the hash # foreach $key (%$ref){ foreach $key (keys %$ref){ # this works # ($value1, $value2)= @$ref{$key} # @$ref{$key} rtns array ref ($value1, $value2)= @{$ref->{$key}} # rtns array vals ##do something... } #However when I pass the same $ref to a sub routine mysub($ref); exit; } #end main() ############################################################; sub mysub{ # my $param = (@_); # this rtns scalar @_ (== 1)) # my ($param) = (@_); # this works ($param = $ref) my $param = shift; # and so does this my $key = ''; my $value1 = 0; my $value2 = 0; # foreach $key (%$param){ foreach $key (keys %$param){ # ($value1, $value2)= @$param{$key} ($value1, $value2)= @{$param->{$key}} ##do something... } return; } ###########################################################; sub RtnRef{ my %myhash = (); my $key = 'key1'; $myhash{'key1'} = [23, 40]; $myhash{'key2'} = [01, 50]; $myhash{'key3'} = [99, 22]; return \%myhash; } ############################################################;