Perl hash

Init

In case blank,

my %numlist;

push data

$numlist{"key1"} = 5;

Number of elements

scalar(keys(%numlist));

foreach

foreach my $key(keys(%numlist)){
    print "Key :" . $key . " Value :" . $numlist{$key} . "\n";
}

Method

sub hashTest {
   my($test, %list) = @_;
   foreach my $key(keys(%list)){
        print "Key :" . $key . " Value :" . $list{$key} . "\n";
   }
}

my $test = 3;
my %hash;
$hash{"open1"} = 511234;
$hash{"open2"} = 513456;
writeIDs($db, %hash);