use strict; use warnings; my (%hash, $want); @hash{qw/a b c/} = (1, 2, 3); $want = 'c'; print $hash{$want};