How about something like this, using a hash instead of an array for @data...
This assumes that there are no duplicate $sub values in the data file. Since you refer to them as identifiers, I'm assuming they are unique identifiers. Anyway, I didn't run any benchmarks (or even test this code), but this approach should speed things up a bit.my %data_hash; foreach $elem (@data) { my ($sub, $max) = split /\|/, $elem; $data_hash{$sub} = $max; } foreach $r (@ref) { my ($id, $time) = split /\|/, $r; my ($key, $instance) = split /:/, $id; if ($data_hash{$key} ne $time) { push @set, join (':', $key, $instance); } }
-Bird
Oh, this will also print any id's in @ref that don't show up in @data at all. You can tweak that if you'd like though, just modify the conditional a bit.
In reply to Re: Large Set Efficiency Question
by Bird
in thread Large Set Efficiency Question
by insensate
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |