#%vars has the structure $vars{$name} = [$local, $value] return \%vars #### my $vars = get_vars_hash($file); Dumper(\%$vars); #just for testing. #outputs #$var1 = { # 'DATE'=>[ # 'G234_DATE', # 'ZERO' # ], # 'STOP'=>[ # 'G234_STOP'' # '60' # ] # } #Which is what I expected foreach $key (keys(%$vars)){ print "$key\n"; } #outputs #DATE #ARRAY(0x1df50b0) #STOP #ARRAY(0x1df5074)