in reply to Arrays merges and redundancies
if (($Entry > 0) && ($ID[$Entry] eq $ID[$Entry - 1])) { for my $ref (\@Value_1, \@Value_2, \@Value_3, \@Value_4, \@Value_5, \@Value_6, \@Value_7, ) { if ($ref->[$Entry] =~ m/($ref->[$Entry - 1])/) { $Placeholder = join(' / ', $ref->[$Entry], $ref->[$Entry - 1] +); delete $ref->[$Entry - 1]; push(@Value, $Placeholder); } } }
Of course, the above is buggy since your posted code was already buggy -- you've got index problems on your counter as soon as you start deleting elements, and that push isn't helping. Also note the added comma in your join. But the loop should answer your question.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|
|---|