Re: fun with hashes!

Uri Guttman <[email protected]> Sun, 25 Nov 2007 19:21:14 -0500
Newsgroups gmane.comp.lang.perl.fun
Message-ID <[email protected]>
>>>>> "s" == shmem  <[email protected]> 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  ------  [email protected]  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org