Re: Dynamically creating a hash for keys()

[email protected] (Vladi Belperchinov-Shabanski)
Newsgroups perl.fwp
Organization CSA
Message-ID <[email protected]>
On Tue, 19 Oct 2004 16:10:01 -0500
[email protected] wrote:

> 
> Vladi Belperchinov-Shabanski <[email protected]>:
> 
> :skip values:
> :
> :%hash = qw( fred filntstone barney rubble tom delong );
> :print( map { $a=!$a ? $_ : () } reverse( %hash ) );
> :
> :perhaps not too bad map() example :)
> :
> :P! Vladi.
> 
> 
> Or, you can do it the regular old un-fun way, and just use a 
> second, temporary hash:
> 
> my %hash = qw(fred flintstone barney rubble tom delong);
> my %hsah = reverse %hash;
> print keys %hsah;
> 

yes. which is shown in at least two posts before mine...
personally I like "values %hash" most :))

-- 
Vladi Belperchinov-Shabanski <[email protected]> <[email protected]>
http://cade.datamax.bg/
Cross the ocean deep, wake now from your sleep
Kiss the past goodbye, don't follow empty skies...
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFBdZEBkBm4tG81shQRAqgJAJwIToJuIHQRmEL2QFAJVsDoWPxcOQCfbVJz
tT7AK1RgcNYVc1ZoHJkbrCI=
=9Fbh
-----END PGP SIGNATURE-----
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.