in reply to Comparing two arrays (was: any smart ideas??:)

You could create a hash, with the elements of one array as the keys. The values contained in the hash aren't important. You can then loop over the other array checking whether each each element matches one of the keys of the hash.
#!/usr/bin/perl -w use strict; # Set up the arrays my @array1 = qw(a b c d); my @array2 = qw(b a e f); # Create the hash, based on array1 my %hash; foreach (@array1) {$hash{$_} = 1;} # Loop through array2 looking for matches foreach (@array2) { if ($hash{$_}) {print $_, "\n"} }