Front page | perl.fwp |
Postings from November 2007
Re: fun with hashes!
Thread Previous
|
Thread Next
From:
Uri Guttman
Date:
November 25, 2007 16:21
Subject:
Re: fun with hashes!
Message ID:
x7ve7pdfgl.fsf@mail.sysarch.com
>>>>> "s" == shmem <gm@cruft.de> writes:
s> You forgot an obscure corner of hashes: hashes in scalar context.
s> Here's a a use - calculate the next power of 2 of a given number:
s> sub next_power_of_two {
s> my %s;
s> @s{1..shift} = ();
s> %s =~ '/';
s> return $';
s> }
s> ;-)
GACK!!!
and that assume knowledge of the internals of hashes. not a good thing
to teach! :)
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
Thread Previous
|
Thread Next