There is a CPAN module Set::Array . I know it may be a little painful
to learn and CPAN modules for such a small application but in the long
run It helps especially if you are repititively going to use these functions
Priss wrote:
> Hello,
>
> I am very new to Perl, wonder if someone can help m
@h{@arr1}=();
delete @h{@arr2};
print join("\n",keys %h),"\n";
david
Priss wrote:
> Hello,
>
> I am very new to Perl, wonder if someone can help me
> with this... if I have:
>
> @arr1 = qw (one two three four five);
> @arr2 = qw (two four);
>
> How can I remove all elements from @arr2 from @
= ($count++) for @arr1;
delete $HASH{$_} for @arr2;
%hORD = reverse %HASH;
@arr1 = ();
push(@arr1,$hORD{$_}) for sort { $a <=> $b } keys %hORD;
> -Original Message-
> From: Priss [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 21, 2002 8:54 AM
> To: [EMAIL PROTECT
See inline comment:
> -Original Message-
> From: Nikola Janceski [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 21, 2002 8:58 AM
> To: 'Priss'; [EMAIL PROTECTED]
> Subject: RE: Remove elements in an array from a different array
>
>
>
On Wed, 21 Aug 2002, Priss wrote:
> Hello,
>
> I am very new to Perl, wonder if someone can help me
> with this... if I have:
>
> @arr1 = qw (one two three four five);
> @arr2 = qw (two four);
This is a faq, perldoc -q intersection
Although for this kind of operations a hash might be better op
Subject: Remove elements in an array from a different array
>
>
> Hello,
>
> I am very new to Perl, wonder if someone can help me
> with this... if I have:
>
> @arr1 = qw (one two three four five);
> @arr2 = qw (two four);
>
> How can I remove all elements from @ar
Hello,
I am very new to Perl, wonder if someone can help me
with this... if I have:
@arr1 = qw (one two three four five);
@arr2 = qw (two four);
How can I remove all elements from @arr2 from @arr1 so
the new array will be @newarr = (one three five)??
Many thanks.
Priss
_