in reply to array from file and compare

I'd highly recommend the Perl Cookbook by O'Reilly. It answers this and many other questions.

Your question is answered on page 106 in section 4.6 as follows:

# Store each of the 'sterren' elements into the hash FirstGroup. foreach $Element ( @sterren ) { $FirstGroup{ $Element } = 1; } # If any of the sterren elements also exist in array politici, # store that value into the hash 'Both'. foreach $Element ( @politici ) { if ( $FirstGroup{ $Element } ) $Both{ $Element } = 1; } # Finally (this step may or may not be necessary depending on what # you want to do) store the keys back into an array. @Result = keys %Both;

"Excellent. Release the hounds." -- Monty Burns.