I am completely bocked out on this, simple string compare program, checks for the string in the array and returns yes or no, but it returns "Yes" for "One", for the rest its always "No"
Correct me please.
Thanks
my @array = ("One", "Two", "Three");
sub DoubleMatch
{
my( $item1,$array_ref1 ) = @_;
for( @$array_ref1 )
{
if( $_ eq $item1 )
{
return 1;
}
return 0;
}
}
# Then you can say:
my $item1 = "One";
if(DoubleMatch( $item1,\@array))
{
print "yes";
}else
{
print "No";
}