my @flattened_pairs; foreach my $thing (@somearray) { my $upper_thing = uc $thing; my @pair = split / /, $upper_thing, 2; push @flattened_pairs, @pair; } return @flattened_pairs;