Hello Anonymous,
Although that the other monks have already answered your question I would like to add something. Why not to use ARRAYS OF HASHES?
Sample of code provided under:
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my @data1 = ( { 'NAME' => 'PAUL DY', 'DATE' => '2009-05-05', 'NUMBER' => '00001', }, { 'NAME' => 'ANTHONY RD', 'DATE' => '2012-01-07', 'NUMBER' => '00003', } ); print Dumper \@data1; =data1 $VAR1 = [ { 'NUMBER' => '00001', 'NAME' => 'PAUL DY', 'DATE' => '2009-05-05' }, { 'DATE' => '2012-01-07', 'NUMBER' => '00003', 'NAME' => 'ANTHONY RD' } ]; =cut my @data2 = ( { 'CAR1' => '1', 'CAR2' => '2', 'CAR3' => '3', }, { 'CAR1' => '1b', 'CAR2' => '2b', 'CAR3' => '3b', } ); print Dumper \@data2; =data2 $VAR1 = [ { 'CAR3' => '3', 'CAR1' => '1', 'CAR2' => '2' }, { 'CAR3' => '3b', 'CAR1' => '1b', 'CAR2' => '2b' } ]; =cut push my @AoH , ( @data1 , @data2 ); =alternatively my @AoH = ( @data1 , @data2 ); =cut print Dumper \@AoH; __END__ $VAR1 = [ { 'NUMBER' => '00001', 'DATE' => '2009-05-05', 'NAME' => 'PAUL DY' }, { 'NUMBER' => '00003', 'NAME' => 'ANTHONY RD', 'DATE' => '2012-01-07' }, { 'CAR3' => '3', 'CAR2' => '2', 'CAR1' => '1' }, { 'CAR1' => '1b', 'CAR2' => '2b', 'CAR3' => '3b' } ];
There are many ways to play around with these just try.
For example you can Making References with array of hashes.
Sample of code:
my $refAoH = \@AoH; print Dumper $refAoH;
Same result as above.
Hope this helps.
In reply to Re: Combining two references
by thanos1983
in thread Combining two references
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |