in reply to Re^2: Hashes, keys and multiple histogram
in thread Hashes, keys and multiple histogram

An array cannot be the key of a hash. Perl stringifies hash keys, so that hash keys are always strings. Even if you tried something like this:
$hash1{\@elements}++;
or
$hash1{[@elements]++;
it would not work, because your key would end up being a stringified array ref (and the array content would be lost).

So either you want to use the string that you've read to be the hash key

$hash1{$line}++;
but that does not seem to be very useful in this context, or you want to store an array reference into the value of the hash
$hash1{"some key"} = \@elements;
but then I am not sure what you would want your key to be.

I think you need to have (and provide us) a clearer idea of the data structure that you want to have at the end of your process.

Quite possibly you really need an array of arrays, rather than a hash of arrays. Quick demonstration under the Perl debugger:

DB<1> @elements = qw/ 1 3 5 4 6/; DB<2> push @array, \@elements; DB<3> @elements2 = qw/ 12 13 14 15/; DB<4> push @array, \@elements2; DB<5> x \@array 0 ARRAY(0x600509af0) 0 ARRAY(0x600500b38) 0 1 1 3 2 5 3 4 4 6 1 ARRAY(0x600500928) 0 12 1 13 2 14 3 15
Update: Perhaps I misunderstood your requirement. Please read my next answer on Aug 17, 2014 at 08:50 UTC (immediately below)