foreach (@$diff) { if (m/^\@\@(.*)\@\@$/) { $str .= qq{
$1
}; } elsif (m/^\-(.*)$/) { push @$old, $1; } elsif (m/^\+(.*)$/) { push @$new, $1; } else { my $tst = $_; $str .= getHTMLDiff($old, $new) . $tst; undef $old; undef $new; } } $str .= getHTMLDiff($old, $new);