Re: Comparing Apples and Oranges

2003-01-09 Thread Rob Dixon
Hi Bob In general a hash is the way to go: my @list1 = qw ( Apple Orange Lemon Tangerine Grape ); my @list2 = qw( Apple Tangerine Grape Banana ); my %list1 = map {($_ => 1) } @list1; my @list3 = grep {$list1{$_}} @list2; print "@list3"; output: Apple Tangerine Grape H

RE: Comparing Apples and Oranges

2003-01-09 Thread NYIMI Jose (BMB)
C:\>perldoc -q intersection Found in C:\Perl\lib\pod\perlfaq4.pod How do I compute the difference of two arrays? How do I compute the intersect ion of two arrays? Use a hash. Here's code to do both and more. It assumes that each element is unique in a given array:

Re: Comparing Apples and Oranges

2003-01-09 Thread Sudarshan Raghavan
Bob Williams wrote: I have two lists. List 1 is the control list containing: Apple, Orange, Lemon, Tangerine, and Grape. List 2 contains Apple, Tangerine, Grape, and Banana. I need a script that compares the two lists and will eliminate banana from list 2 because banana is not in the control L