while (my ($key, $val) = each %t_loop) { $val = join(' ', @$val) if ref $val; $final .= "$key=$val\n"; }