foreach (@bz_comments){ ($who, $bug_id, undef, $date, undef, $body) = split(/,/, $_); $BZ_comment{$bug_id} .= "

$who $date

$body

"; } while (my ($id, $comment) = each %BZ_comment){ push(@bz_comments_OUTPUT, "$id , $comment"); }