use warnings; use strict; foo('bar'); my %hash = (bar => 'value'); sub foo { print $hash{+shift} }