in reply to Create a hash whose keys and values come from a given array

You seem to want a very arbitrary structure, but here's one way for the given example data:

c:\@Work\Perl\monks>perl -wMstrict -MData::Dump -le "my @array = ('a', 1, 2, 3, 4, 'b', 6, 7, 8); ;; my %hash = ( $array[0] => [ @array[ 1 .. 4 ] ], $array[5] => [ @array[ 6 .. 8 ] ], ); ;; dd \%hash; " { a => [1, 2, 3, 4], b => [6, 7, 8] }
Can you be more specific about what you really want?


Give a man a fish:  <%-{-{-{-<