perl push an array to hash
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
my @array=qw /fm1 fm2 fm3 fm4 fm5 fm6/;
print "\n\@array: @array\n\n";
my %hash;
my $key1="gene1";
my $key2="gene2";
print "\$key1: $key1\n\$key2: $key2\n\n";
my @array1 = @array[0..2];
my @array2 = @array[3..5];
print "\@array1: @array1\n\@array2: @array2\n\n";
$hash{$key1}=\@array1;
$hash{$key2}=\@array2;
print Dumper(\%hash);
##############################
@array: fm1 fm2 fm3 fm4 fm5 fm6
$key1: gene1
$key2: gene2
@array1: fm1 fm2 fm3
@array2: fm4 fm5 fm6
$VAR1 = {
'gene1' => [
'fm1',
'fm2',
'fm3'
],
'gene2' => [
'fm4',
'fm5',
'fm6'
]
};