Initializing a hash can be done with an array, each pair of values in the array form key and value of the hash. Often '=>' is used as an alias to ',' to make this obvious:
my %hash= (0, 'ticket', 1 => 'dateadded');
{$names{$_}} on the other hand is not a really useful expression in perl, %{$names{$_}} refers to a hash whose reference is stored as value in another hash (i.e %names). A multidimensional hash or HashOfHashes in perlspeak
If what you wanted was a Hash of Hashes, the syntax looks like this:
$names{$_}{key}= 'value';
#or to initialize with an array:
%{$names{$_}} = ('key1' => 'value1','key2' => 'value2');
if you want further information about HoH (Hash of Hashes), you might want to read perldsc and perllol
|