in reply to Re: Re: comparing array elements
in thread comparing array elements
Why do you need two for-loops? Wouldn't one work?
my @array1 = ('test', 'text', 'next'); my @array2 = ('text', 'test', 'next'); for (my $i=0; $i < scalar(@array1); $i++) { if ($array1[$i] eq $array2[$i]) { print "$array1[$i] matches\n"; } }
|
---|
In Section
Seekers of Perl Wisdom