Re: Remove elements in an array from a different array

2002-08-22 Thread Ramprasad A Padmanabhan
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

Re: Remove elements in an array from a different array

2002-08-21 Thread david
@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 @

RE: Remove elements in an array from a different array

2002-08-21 Thread Shishir K. Singh
= ($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

RE: Remove elements in an array from a different array

2002-08-21 Thread Nikola Janceski
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 > > >

Re: Remove elements in an array from a different array

2002-08-21 Thread Sudarshan Raghavan
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

RE: Remove elements in an array from a different array

2002-08-21 Thread Nikola Janceski
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

Remove elements in an array from a different array

2002-08-21 Thread Priss
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 _