my %arrays = ( type1 => [ "look", "at", "me", "go", ], type2 => [ "watch", "me", "exeunt", ], type3 => [ "see", "me", "disappear", ], ); $type = get_type(); print "element 1 if $type is $arrays{$type}[0]\n";