in reply to Re^2: Combining two references
in thread Combining two references

No. Read why in my previous post.

Replies are listed 'Best First'.
Re^4: Combining two references
by Anonymous Monk on Jun 08, 2015 at 19:39 UTC
    We can use the columns names from here:

    name - date - number - car1 - car2 - car3

    DB will be MS SQLServer

    Thanks!

      Here's some code I quickly threw together. Let me know if the below output is closer to what you're looking for.

      #!/usr/bin/perl use warnings; use strict; use Data::Dumper; my $data1 = [ { 'NAME' => 'PAUL DY', 'DATE' => '2009-05-05', 'NUMBER' => '00001', }, { 'NAME' => 'ANTHONY RD', 'DATE' => '2012-01-07', 'NUMBER' => '00003', }, ]; my $data2 = [ { 'CAR1' => '1', 'CAR2' => '2', 'CAR3' => '3', }, { 'CAR1' => '1b', 'CAR2' => '2b', 'CAR3' => '3b', }, ]; my @results; for my $data1_href (@$data1){ my %current_row; for my $entry (qw(name date number)){ $current_row{$entry} = $data1_href->{uc($entry)}; } my $data2_href = shift(@$data2); for my $entry (qw(car1 car2 car3)){ $current_row{$entry} = $data2_href->{uc($entry)}; } push @results, \%current_row; } print Dumper \@results;

      Output (Dumper):

      $VAR1 = [ { 'name' => 'PAUL DY', 'car2' => '2', 'car3' => '3', 'number' => '00001', 'car1' => '1', 'date' => '2009-05-05' }, { 'date' => '2012-01-07', 'car1' => '1b', 'number' => '00003', 'car3' => '3b', 'car2' => '2b', 'name' => 'ANTHONY RD' } ];

      Here's an example on how to use each record:

      for my $entry (@results){ print "$entry->{name}\n"; print "$entry->{car1]\n"; #...etc.

      -stevieb

Re^4: Combining two references
by Anonymous Monk on Jun 08, 2015 at 18:55 UTC
    OK, read that, the idea here is to have each row inserted in a db table.

      It would help if you listed (in order preferably) the column names for each row. Which DB backend are you using? There are plenty of modules that do most of this work for you.