telcontar has asked for the wisdom of the Perl Monks concerning the following question:
@b = sort {$a <=> $b} @b; @a = sort {$a <=> $b} @a; print "@b\n"; for (@a) { if (defined($b[$i])) { if (not $_ == $b[$i]) { push @c, $_ } else { $i++ } } else { push @c, @a[($j..$#a)]; last; } $j++; }
@c = grep { defined($b[0]) and !($b[0] eq $_) or !shift @b } sort {$a <=> $b} @a;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: most efficient way to implement "A without B"
by Zaxo (Archbishop) on Apr 09, 2005 at 18:07 UTC | |
Re: most efficient way to implement "A without B"
by bobf (Monsignor) on Apr 09, 2005 at 19:45 UTC | |
Re: most efficient way to implement "A without B"
by tlm (Prior) on Apr 09, 2005 at 20:25 UTC | |
Re: most efficient way to implement "A without B"
by sh1tn (Priest) on Apr 09, 2005 at 20:01 UTC |