in reply to perl strange hash value

What do you mean by "when I dump the hash"? Doing a simple print scalar %myhash does not give you the contents of the hash: it tells you how much key-slots are available (second figure) and how much of these are in use (first figure).

To get the contents of a hash use keys, values or each. Or have a look at Data::Dumper.

Update: Thanks Davido for pointing out that I missed scalar in my example.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics

Replies are listed 'Best First'.
Re^2: perl strange hash value
by robertw (Sexton) on Sep 08, 2012 at 15:13 UTC

    Underneath I first print my hash, then i print a hash stored in a the hash (aegon) but i cant acces the array like this $totalhistoricalhash{Aegon}{$Aegon1} because that prints nothing, and $totalhistoricalhash{Aegon} prints only 11/16. I dont get how to access one of these variables because I am doing something wrong:S. I dumper both by the with perl dumper(/)

    $VAR1 = { 'ArcelorMittal' => '54/128', 'Aperam' => '28/64', 'Unilever' => '246/512', 'Ahold' => '19/32', 'Akzo' => '33/64', 'PostNL' => '141/256', 'DSM' => '104/256', 'Philips' => '135/256', 'TNT' => '219/512', 'Randstad' => '147/256', 'Royal' => '159/256', 'Wolters' => '238/512', 'SBM' => '212/512', 'Reed' => '153/256', 'ASML' => '46/128', 'Heineken' => '120/256', 'Boskalis' => '67/128', 'Aegon' => '11/16', 'Corio' => '74/128', 'Fugro' => '113/256', 'ING' => '57/128', 'KPN' => '129/256', 'TomTom' => '228/512' }; $VAR1 = { 'Aegon2' => [ '4,109', '4,280', '4,09', '4,28' ], 'Aegon7' => [ '4,100', '3,996', '3,98', '4,11' ], 'Aegon3' => [ '4,045', '4,107', '4,03', '4,13' ], 'Aegon14' => [ '4,175', '4,249', '4,18', '4,28' ], 'Aegon1' => [ '4,300', '4,318', '4,29', '4,38' ], 'Aegon4' => [ '4,087', '4,067', '4,06', '4,12' ], 'Aegon13' => [ '4,209', '4,249', '4,16', '4,28' ], 'Aegon10' => [ '4,111', '4,169', '4,10', '4,20' ], 'Aegon5' => [ '4,061', '4,100', '4,05', '4,12' ], 'Aegon9' => [ '4,127', '4,151', '4,12', '4,18' ], 'Aegon11' => [ '4,180', '4,103', '4,07', '4,19' ], 'Aegon12' => [ '4,286', '4,198', '4,16', '4,30' ], 'Aegon6' => [ '4,009', '4,083', '4,00', '4,12' ], 'Aegon8' => [ '4,147', '4,122', '4,08', '4,16' ] };