my %hash; @hash{ qw/ one two three / } = ( 1 .. 3 ); foreach ( qw/ one one three two one / ) { print $hash{$_},"\n"; }