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;
:On Tue, 19 Oct 2004 09:50:39 -0400
:Jason Foster <[email protected]> wrote:
:
:> Can anyone help me to understand why this code refuses to compile?
:> Even better, can anyone help fix it :)
:>
:> %hash = qw( fred filntstone barney rubble tom delong );
:> print( keys( reverse( %hash ) ) );
:>
:> The error message...
:>
:> Type of arg 1 to keys must be hash (not reverse) at ./killme.pl
:> line 4, near ") ) "
:>
:> ... was pretty confusing since it implies that "reverse" is a type?!
:>
:> I tried making an anonymous hash as follows...
:>
:> print( keys( %{ reverse( %hash ) } ) );
:>
:> ... but got no results at all.
:>
:> Help!
:>
:>
:
:
:--
: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=_Wed__20_Oct_2004_00_05_33_+0300_/hsRUoqeK82QoMTI
:Content-Type: application/pgp-signature
:
:-----BEGIN PGP SIGNATURE-----
:Version: GnuPG v1.2.3 (GNU/Linux)
:
:iD8DBQFBdYGfkBm4tG81shQRAmmFAJ0aiCyCs/eZ2DU4rhW/elojY70qTQCfRVWY
:6fmnpWcgq2FP8aQufJD2RZY=
:=dsVM
:-----END PGP SIGNATURE-----
:
:--Signature=_Wed__20_Oct_2004_00_05_33_+0300_/hsRUoqeK82QoMTI--
:
:
--
DVS
Dandelions are weak.
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.