This short script should do what you want.
--------------------------------
@MainArray = ( 'one', 'two', 'three', 'four' );
@SubArray = ( 'two', 'three' );
foreach $Item( @MainArray, @SubArray ) {
$Hash{$Item}++;
}
foreach $Key ( keys %Hash ) {
if( $Hash{$Key} > 1 ) {
foreach $i (reverse( 0 .. $#MainArray )) {
splice( @MainArray, 1, $i ) if( $MainArray[$i] eq $Key);
}
}
}
print join( ',', @MainArray ), "\n";
------------------------------
The contents of @MainArray are now ('one', 'four').
Hope this helps,
--Chuck
--- Veeraraju_Mareddi <[EMAIL PROTECTED]> wrote:
> Dear Group,
>
> Is there any PERL Function for removing an array of items from another
> array.
>
> I have a main array of elements and one more array of elements which is
> subset of main array. I want to remove those items which are common in two
> arrays from Main Array.Please tell me is there any of getting it done
>
> Thanx and regards
> Rajuveera
>
>
>
> _______________________________________________
> Perl-Win32-Admin mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin
__________________________________________________
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin