I would like to start with an empty hash, and then insert hash of hashes of the same kind into the hash.
#!/usr/bin/perl
use strict;
use warnings;
my %h = {};
$h{"1"} => {
a => -1,
b => -1,
c => [
{
d => -1,
e => -1,
},
],
};
However this gives
Useless use of hash element in void context at ./hash.pl line 8.
Useless use of anonymous hash ({}) in void context at ./hash.pl line 8.
Reference found where even-sized list expected at ./hash.pl line 6.
It is sort of a database I would like to make, where I can insert the delete structures of the $h{"1"} kind.
Any ideas how to do this?
To initialize a hash you use
%h = ().{}is a reference to an empty anonymous hash. Try this: