use strict; foreach my $field (param) { #cover multivalued fields like checkboxes? Is this correct? foreach my $value (param($field)) { #not sure what the mapping and undef are doing with the field variable? next if exists { map {$_ => undef } qw(city state country) } -> { $field }; #process non blank thedata variable if($value !~ /^\s*$/) { my $thedata .= "$field\:\t$value
"; } } }