bowei_99 has asked for the wisdom of the Perl Monks concerning the following question:
For instance, the following code
yields#!/usr/bin/perl use Data::Dumper; %h = ( 1 => "one", 2 => "two", 3 => "", 4 => "four", # 5 => "five", ); print "h is " . scalar %h . "\n"; print "Dump is " . Dumper(\%h);
So, from experimenting with this code by commenting out elements in %h, I figure the first value is the number of keys, but I'm not sure what the second value is. It stays at 8 no matter what I change. I remember vaguely it has something to do with how densely the hash is populated.... Can anybody tell me what it is?# perl test.pl h is 4/8 Dump is $VAR1 = { '1' => 'one', '2' => 'two', '3' => '', '4' => 'four' };
-- Burvil
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Effect of scalar function on hash
by friedo (Prior) on Mar 22, 2006 at 21:39 UTC | |
|
Re: Effect of scalar function on hash
by ikegami (Patriarch) on Mar 22, 2006 at 21:53 UTC | |
by ysth (Canon) on Mar 23, 2006 at 11:03 UTC | |
|
Re: Effect of scalar function on hash
by ysth (Canon) on Mar 23, 2006 at 11:12 UTC |