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

HTH,

Rob




"Bob Williams" <[EMAIL PROTECTED]> wrote in message
003101c2b7df$59f7d780$[EMAIL PROTECTED]">news:003101c2b7df$59f7d780$[EMAIL PROTECTED]...
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 List 1. The script will not add
Orange to List 2 even tho it is in the Control List 1.

Perhaps the script would create list 3 with the results (Apple, Tangerine,
and Grape)?

Thanks

Bob Williams



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to