sub moo { my $self = shift; my ($foo, $bar) = @$self{qw(foo bar)}; # .. }