in reply to Array compare not matching all elements
You already got some great solutions. Here's my 2 cents:
#!/usr/bin/env perl use strict; use warnings; use diagnostics; use Array::Contains; my @array1 = ("A2","A5","C1","G0","T3","T4"); my @array2 = ("A2","A3","A5","G1","G0","G4"); foreach my $elem (@array1) { print "$elem\n" if(contains($elem, \@array2)); }
Edit: I just love those kind of Perl questions where there are so many different solutions to choose from. Really shows of the flexibility of the language!
|
---|