On Fri, Apr 20, 2001 at 09:29:04AM -0400, Nutter, Mark wrote:
> bash$ perl -e '
> > @ary = ('a', 'b', 'c', 'b', 'a');
> > %hsh = (); # empty hash
> >
> > foreach $item (@ary)
> > {
> > $hsh{$item} = 1;
> > }
> >
> > @ary = keys %hsh;
> >
> > print (join "\n", @ary);'
> a
> b
> c
But don't go relying on the ordering of the array. Hashes don't
preserve order. If you need an ordering, impose it. eg
print join "\n", sort @ary;
--
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net
- Stupid Hash Tricks Nutter, Mark
- Re: Stupid Hash Tricks Paul Johnson
- Re: Stupid Hash Tricks Dan Brown
- RE: Stupid Hash Tricks Nutter, Mark
- RE: Stupid Hash Tricks Stout, Joel R
- Re: Stupid Hash Tricks Dan Brown
- RE: Stupid Hash Tricks Nutter, Mark
