# Patch up the data for (my $i=1; $i < $#table; ++$i) { # check surrounding items and patch the data, as needed . . . }