in reply to More efficient Data Structure needed
Another suggestion is that, you can have both arrays sorted, then you only need to go thru both of them once, now we are talking about plus, no more multiply.foreach my $record (@data) { foreach my $data (@m_info) { if ($record->[1] =~ /$data->[0]/) { $record->[1] = $data->[3]; $record->[1] = join ("", $record->[1], "_", $data->[1]); last;#jump out of the inner loop if you found the match } } }
|
|---|