map { my $key = (split /,/, $_)[$idx]; chomp $key; $key =~ s/[-+]//g; # and so on... [ $_, $key ] } @array;