This is the mail archive of the
automake@gnu.org
mailing list for the automake project.
Re: More fixes for assembler support
- To: automake@gnu.org
- Subject: Re: More fixes for assembler support
- From: olly@muscat.co.uk (Olly Betts)
- Date: 12 May 1999 18:41:50 -0000
- Mail-Followup-To: automake@gnu.org
- Organization: Muscat Ltd -- http://www.muscat.co.uk/
- References: <Pine.LNX.4.10.9904301003460.26810-200000@intra.typhoon.spb.ru> <87lnfa80om.fsf@cygnus.com>
In article <87lnfa80om.fsf@cygnus.com>, Tom Tromey wrote:
>>>>>> "Pavel" == Pavel Roskin <pavel_roskin@geocities.com> writes:
>Pavel> 4) Just in case, %suffixes renamed to %uniquify, to avoid using
>Pavel> @suffixes and %suffixes in the same procedure. Is there "sort
>Pavel> -u" in Perl?
>
>I think it is safe to have a hash and a list with the same name.
It's safe for perl - potentially confusing for the programmer if abused, but
I'd argue it's actually helpful if they serve the same purpose as in this
case.
>I don't know of a `sort -u'; I always use a hash. I suppose we could
>write a convenience function, but it hasn't seemed important.
Using a hash is probably a good a way as any, though it is likely to eat a
lot of memory if your array is enormous. Alternatively you can use map like
this to "uniq" the array after sorting it:
my $x;
@out = map {$_ eq $x ? () : ($x = $_)} sort @in
That's perl 5 code BTW.
Cheers,
Olly