One way: To find out elements which are in test2 and not in test1:
#!-*-perl-*-<ur perl path> use strict; my @test1 = qw(1 2 3 4); my @test2 = qw(1 2 5 6 7 8); foreach my $element(@test2) { print $element if([EMAIL PROTECTED]); } -Sharad -----Original Message----- From: Boon Chong Ang [mailto:[EMAIL PROTECTED] Sent: Friday, June 13, 2003 9:19 PM To: [EMAIL PROTECTED] Subject: compare, checking and listing Hi, I have two array, @test1, @test2. Just say, I want compare @test2 with @test1 in such manner. @test2 could contains more, less or equal elements compare to @test1 which I don't know. I want to write a perl script to compare @test2 to @test1 and list out those element within @test2 that is not represent within @ test1 and those elements within @test1 that has not found the match from the @test2 How do I accomplish such task efficiently? Thank you & best regards, ABC