in reply to Passing a reference to an element in an array of hashes
I don't know what you did in the first version, but I get a warning message there too. Could it be that you had warnings off in that version?
To find such bugs it is often helpful to add a line like print ":$_[0]:$_[1]:$_[2]:\n"; before the problem line
The reason is that your array (of hashes) is empty, $array_of_hashes[0] does not exist. If you add a line push @array_of_hashes,{}; before the call of Add_key_and_value, the warning vanishes
UPDATE: My observation that I got a warning message for the first version was wrong, the warning came from the print statement I added. Doh
|
|---|