use Data::Dumper; %foo=(BAZ=>1); print Dumper \%foo if call($foo{BAR}); print Dumper \%foo if call(@foo{BAR,BAZ}); sub call { return 1 }