Googy said:
Hi,
I can't able to find answers for this basic question, I googled and did
everything possible to find an answer,
There are methods to delete and find the existence of an item in the
hash but not for inserting or appending a new item into perl hash.
It's in the part of the Perl documentation called "perldata"; you get
there by issuing perldoc perldata on a command line, or going to
the relevant part of the HTML documentation.
I looked on your behalf, though, and found it not particularly easy to
find the information you want, so here's a quick tutorial. There's more
to it than this (the really good Perl people in this group will be able
to tell you more).
To insert a new item into a hash just give it a value:
$myhash{"newkey"} = "newvalue";
$anotherhash{$the_new_key} = $some_other_variable;
If you already have one of those items in the hash then you'll
over-write it, so you may need to add "... unless exists
$myhash{newkey}" or whatever.
Note the dollar sign, not a "%": a single element of a hash is a scalar.
Maybe you knew that already but it is confusing if you don't.
"Append" has no meaning; hashes are not ordered. (And if you iterate
over them they won't come out in the order you expect, or any other
given order either).