Re: Dynamically creating a hash for keys()

[email protected] (Georg Moritz)
Newsgroups perl.fwp
Message-ID <[email protected]>
From the keyboard of Paul Makepeace [20.10.04,10:13]:

> Je 2004-10-20 10:04:25 +0100, Georg Moritz skribis:
> > From the keyboard of Jason Foster [19.10.04,09:50]:
> > > I tried making an anonymous hash as follows...
> > >
> > >      print( keys( %{ reverse( %hash ) } ) );
> >
> > wrong brackets ;-)
> >
> > print keys %{{reverse @{[%hash]}}}
> >
> > coerce the hash into an anonymous array, deref it, reverse the
> > resulting list, put it into an anonymous hash, get keys from the ref
>
> This is unnecessary - reverse can operate directly on a hash (as I think
> has been posted a coupla times elsewhere); perldoc -f reverse
>
> P

right, because a hash is a list in list context.
sorry for posting first and reading the thread later :-/

-- 
_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s,/,($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e,e && print}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.