perlquestion
Perl300
<p>Hi all.</p>
<p>
I am using this same approach from "Intermediate Perl" to check if an element of two dimensional array exist in a hash:
<c>
my %hash = map { $_, 1 } @castaways;
foreach my $person (@list_1) {
if( $hash{$person} ) {
print "$person is a castaway.\n";
#do something more
}
}
</c>
My problem is, the strings I'll have in @castaways and @list_1 are uppercase as well as lowercase.
So as of now, the if condition fails if the string in @castaways is 'Hello' while in @list_1 it is 'hello'.
</p>
<p>Is there any way to make the if condition do case insensitive match? I am trying to avoid making any change in the @castaways and @list_1 as they are taken from different sources and will be sent to other applications for processing. I don't know if changing case would mess things up for others.</p>
<p>UPDATE: Marked as solved in subject.</p>