Tony Bowden <[EMAIL PROTECTED]> writes:
> OK, my brain has fried.
>
> How can I do this:
>
> my @list = qw/foo bar foo baz/;
> my %hash = map { $_ => 1 } @men;
> my @sort = sort keys %hash;
> print "We have @sort\n"; # foo bar baz
>
> without the %hash?
>
> i.e. something akin to: my @sort = sort keys map { $_ => 1 } @list;
>
> I've tried so many variations that my brain is refusing to tell me the
> correct answer.
my $last;
do {print $_ unless $_ eq $last; $last = $_} for sort @list
Dunno if it's quicker than the cunning tricks with map, but hey, it
works.
--
Piers