in reply to Comparing strings
If the idea is to find the common elements, with case insensitivity, then you can use hashes. Let the keys be uppercased for all entries, and the values be the originals. Then you can use standard techniques for set comparison using hashes.
my %a = map {( uc($_) => $_ )} @a; my %b = map {( uc($_) => $_ )} @b; my @common_keys = grep { exists $a{$_} } keys %b; my @a_values_seen_in_b = @a{ @common_keys }; my @b_values_seen_in_a = @b{ @common_keys };
There are also modules on CPAN for tied hashes which allow you to store and retrieve keys case-insensitively; but I don't think they're necessary for this problem.
|
|---|