Strange output problem




I'm trying to output some data into an html table with this code:

print "\n";
for my $array ( @sorted ) {
print "<tr>";
for my $element ( @$array ) {
print "<td>" . $element . "</td>";
}
print "</tr>";
print "\n";
}

However after successfully outputting several rows it sometimes
randomly throws in a row like this:

<tr><td>CY</td><td>2.4321</td><td>16.79</td><td!>+0.04</td></tr>
where one of the <td> tags is instead <td!> which is clearly wrong.

Any idea?

.