[6836] in Perl-Users-Digest
Perl-Users Digest, Issue: 461 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 12 13:07:15 1997
Date: Mon, 12 May 97 10:00:15 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 12 May 1997 Volume: 8 Number: 461
Today's topics:
Re: Dups in a array.. how to clear? <billc@tibinc.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 09 May 1997 21:48:59 -0400
From: Bill Cowan <billc@tibinc.com>
Subject: Re: Dups in a array.. how to clear?
Message-Id: <3373D40B.3583@tibinc.com>
Ray McVay wrote:
>
> Tony Reeves wrote:
> >
> > I have a large arrray..
> > @ALLUSERS - about 9,000 records.
> >
> > I'd like to know a simple way to remove any duplicates that might be in the
> > file. that is if the file has:
> >
[SNIP]
> Well yes, grep works. ;-) I'd just throw the lot of 'em into a hash and
> let IT do the dirty work.
One approach is:
my @InputArray = (0,0,1,2,0,3,4,2,5);
my @OutputArray = ();
my %TmpHash = ();
#-- Remove duplicate entries from an array.
@OutputArray = grep((++$TmpHash{$_} == 1), @InputArray);
print join(',', @OutputArray), "\n";
prints: 0,1,2,3,4,5
-- Bill
-----------------------------------------------------------------------
Bill Cowan <billc@tibinc.com> Voice:919-490-0034 Fax:919-490-0143
Tiburon, Inc./3333 Durham-Chapel Hill Blvd Suite E-100/Durham, NC 27707
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 461
*************************************