in reply to named_arguments in subroutine

Could you include a snippet of code that can be run which reproduces the issue and your expected output, it is somewhat unclear what you mean

When you say you passed a hash, do you mean you called the routine with a hash as a parameter? and if so did you call it like
my $value=mySub(%hash); or my $value=mySub(\%hash;)
Example call below

#! /usr/bin/perl use strict; use warnings; my %hash=qw(fruit apple dairy cheese cereal oats); sub whatis{ my $hash=shift; for my $category (keys %{$hash}){ print "$hash->{$category} is a $category\n"; } } whatis(\%hash);

Or do you mean that the subroutine returns a hash and you wish to access a value of this hash by it's key? Horrible example below

#! /usr/bin/perl use strict; use warnings; sub foodCategories{ my %hash=qw(fruit apple dairy cheese cereal oats); return \%hash; } sub whatis{ for my $category (keys %{foodCategories()}){ print &foodCategories->{$category}," is a $category\n"; } } whatis();
Update: added code examples