in reply to Re^2: converting an array to an hash
in thread converting an array to an hash

but I want something like this:
%hash = (1 => value's list, 2 => values's list, n => value's list)
How can I build that?

Sorry, but I have no idea what you mean by that?


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^4: converting an array to an hash
by savio (Initiate) on Dec 22, 2014 at 17:54 UTC

    I mean an hash of array of numbers, i.e.:

    %hash = (1 => 3, 4, 5, 1, 2 => 1, 2, 3, 4, 3 => 3, 3, 1, 6);

      I mean an hash of array of numbers, i.e.:

      See PerlDataStructureCookbook

      my %hash = ( 1 => [ 3, 4, 5, 1 ], 2 => [ 1, 2, 3, 4 ], 3 => [ 3, 3, 1, 6 ], );

      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      I guess. Do you mean this?

      #!/usr/bin/env perl use strict; use warnings; use Data::Dumper; $Data::Dumper::Sortkeys = 1; my @data = ( [ 3, 4, 5, 1 ], [ 1, 2, 3, 4 ], [ 3, 3, 1, 6 ] ); my %hash = map { $_ => $data[$_] } 0 .. $#data; print Dumper \%hash; __END__ $VAR1 = { '0' => [ 3, 4, 5, 1 ], '1' => [ 1, 2, 3, 4 ], '2' => [ 3, 3, 1, 6 ] };

      Regards, Karl

      «The Crux of the Biscuit is the Apostrophe»