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); } } }