Mine
public text v1 · immutableprint "id,type,level\n";
for (my $x = 1; $x <= $#sortedbuildings; $x++) {
if (exists $sortedbuildings[$x])
{
print "$x";
for (my $y = 0; $y <= $#{$sortedbuildings[$x]}; $y++) {
print ",$sortedbuildings[$x][$y]";
}
print "\n";
}