... foreach my $field (sort @$field_order) { print "\t\n"; print "\t\t$field :\n"; for my $i (0 .. $num_recs) { print "\t\t$records->[$i]->{$field}\n"; } print "\t\n"; } #### ... # heres the new line of code $records->[$i]->{$field} .= ""; print "\t\t$records->[$i]->{$field}\n"; ... #### length($records->[$i]->{$field})