Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!bu.edu!cs.bu.edu!ckd From: ckd@cs.bu.edu (Christopher Davis) Newsgroups: comp.lang.perl Subject: Re: sort -uniq in perl? Message-ID: Date: 8 Sep 90 01:35:00 GMT References: Sender: news@bu.edu.bu.edu Reply-To: ckd@cs.bu.edu (Christopher Davis) Organization: 1000000011000101, Inc. Lines: 19 In-reply-to: ckd@cs.bu.edu's message of 8 Sep 90 01:24:20 GMT Well, I went back and hacked this little thing up, but I'm still open to suggestions for a better way to do it. sub Uniquify { # assumes sorted array local(@inary) = @_; foreach $inline (@inary) { if ($inline ne $oldinline) { push(@outary,$inline); } $oldinline = $inline; } return @outary; } # tear here, my .signature's not valid perl code yet -- Christopher Davis, BU SMG '90 <...!bu.edu!cs.bu.edu!ckd> "Dammit, we're all going to die, let's die doing something *useful*!" --Hal Clement on comments that space exploration is dangerous