S
Steve
Hi all,
I'm trying to count occurrences of elements in array1 that aren't in
array2. Currently I'm doing this by converting one array to a hash and
using 'exists':-
my %foo;
my $score = 0;
@foo{@array2} = (); # Convert array to hash (for exists)
for (@array1) { $score++ unless exists $foo{$_} };
Whilst this seems to work I'm sure there's a more efficient method.
Any suggestions?
Thanks
I'm trying to count occurrences of elements in array1 that aren't in
array2. Currently I'm doing this by converting one array to a hash and
using 'exists':-
my %foo;
my $score = 0;
@foo{@array2} = (); # Convert array to hash (for exists)
for (@array1) { $score++ unless exists $foo{$_} };
Whilst this seems to work I'm sure there's a more efficient method.
Any suggestions?
Thanks