Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: Adding an new element to array.

by Anonymous Monk
on Aug 21, 2013 at 18:19 UTC ( #1050396=note: print w/replies, xml ) Need Help??


in reply to Re: Adding an new element to array.
in thread Adding an new element to array.

OK may be I am not been clear but this is the reason:
my $data = $dbh->exec("select * ......"); if($data) { my $more_data = $dbh ->exec("select * ...."); if($more_data) { my $name = $more_data->[0]{ NAME }; push @{$data}, {doc_type => $name}; } } print Dumper(@$data);
Thanks!

Replies are listed 'Best First'.
Re^3: Adding an new element to array.
by poj (Monsignor) on Aug 21, 2013 at 19:13 UTC
    #!perl use strict; use Data::Dump 'pp'; my $data = [{ 'DATE' => '2013-04-25', 'TW' => '1','REF' => '1234567', 'ACC' => '33456790' }]; my $more_data = [{'DOC1' => 'EMAIL1','DOC2' => 'EMAIL2'}]; my @keys = keys %{$more_data->[0]}; @{$data->[0]}{@keys} = @{$more_data->[0]}{@keys}; pp @$data;
    poj

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1050396]
help
Chatterbox?
[atcroft]: Discipulus: I looked back at your note about my Padre question from a while back, and it made me look again... as a result, I found what I was missing and was able to make the change. Thank you!
[LanX]: maybe better /msg discipulus ?
[atcroft]: I thought I saw them on, and just wanted to let them know.
[LanX]: hmm ... or even better /msg /msg [discipulus]

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2018-02-24 20:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (311 votes). Check out past polls.

    Notices?