use strict; use Data::Dumper; my @line1 = ('_W9C2JJDCB','
This is the problem1.
','This is res1
'); my @line2 = ('_W9C2JJDCB','This is the problem2.
','This is res2
'); my @line3 = ('_W9C2JJDCB','This is the problem3.
','This is res3
'); my @line4 = ('_W8CXXXXAB','hi there
','why are you capitalizing paragraph tags?
'); my @totlines; #push (@totlines,\@line1); #push (@totlines,\@line2); #push (@totlines,\@line3); push @totlines, \@line1, \@line2,\@line3,\@line4; my @dir1 =('_W9C2JJDCB', '201200240', 'TEST: IGNORE', 'John Doe', 'Closed', 'HIP', 'email@email.com', 'email2@email.com', ); my @dir2 = ( '_W8CXXXXAB', '2012192222', 'WHAT: HELL', 'Captain Jack', 'Wide Open', 'UNCOOL', 'you@notme.com', 'stillyou@notme.com'); my %hash = ( '_W9C2JJDCB' => \@dir1); $hash{'_W8CXXXXAB'} = \@dir2; for my $key (keys %hash){ foreach my $u (@totlines) { if($key eq $u->[0]) { #print qq|$key is equal to $u->[0]\n|; push @{$hash{$key}},@$u; } } } print Dumper \%hash; ####
$VAR1 = {
'_W9C2JJDCB' => [
'_W9C2JJDCB',
'201200240',
'TEST: IGNORE',
'John Doe',
'Closed',
'HIP',
'email@email.com',
'email2@email.com',
'_W9C2JJDCB',
'This is the problem1.
',
'This is res1
',
'_W9C2JJDCB',
'This is the problem2.
',
'This is res2
',
'_W9C2JJDCB',
'This is the problem3.
',
'This is res3
'
],
'_W8CXXXXAB' => [
'_W8CXXXXAB',
'2012192222',
'WHAT: HELL',
'Captain Jack',
'Wide Open',
'UNCOOL',
'you@notme.com',
'stillyou@notme.com',
'_W8CXXXXAB',
'hi there
',
'why are you capitalizing paragraph tags?
'
]
};
####
perl -e '@a = 1..5; print @a[1..@a];'