use warnings;

%parts = {};

$parts{'ms51957-101'} = 1207;
$parts{'ms51957-102'} = 17;
$parts{'ms51957-103'} = 1;

print "Number of Records in hash: ", scalar keys %parts, "\n";

Number of Records in hash: 4
------------------------

> To my surprise, this is wrong; there are only 3 records in the hash.

not quite - {} is an empty, anonymous hash, assigned as a key to the first 
entry in %parts. undef is the value.  Should've seen:
Reference found where even-sized list expected at -e line 3.

%parts = ();

clears it but isn't needed if parts is new:
my %parts;

will ensure a new, empty hash.

a
-------------------
Andy Bach
Systems Mangler
Internet: andy_b...@wiwb.uscourts.gov
Voice: (608) 261-5738; Cell: (608) 658-1890

Entropy just ain't what it used to be
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to