in reply to mysql DBI Queries to variables
Isn't a simple way to map the data array to a new array in the order you want?
my @reordered = @elements[1,2,0];
A Monk aims to give answers to those who have none, and to learn from those who know more.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: mysql DBI Queries to variables
by finhagen (Sexton) on Dec 12, 2012 at 23:59 UTC | |
Thanks again for your kind assistance. Thank your for your reply. The goal isn't to reorder the elements in the array, it's to address the elements so I can place them in the spreadsheet cells wherever I please. However, to your point, since, in my script, the output of my query appears to be placed into the variable $emc and then added to the @data array, why can't I address the elements of the @data array as $data[0], $data1 and so forth? It would be helpful to understand more clearly what is happening to the output of the SQL query - how is perl variablizing that output? When I try addressing the data as $data[0], I get an error "Not an array ref in call to write_row() at ./AcntRptTest2.pl line 222". Line 222 is while(my @data = $emc ->fetchrow_array).My revised code which produces that error is: I'm sure my error is simple and probably obvious to the wise monks who toil for our benefit, so I appreciate your patient assistance.
Hagen Finley
Boulder, CO
| [reply] [d/l] [select] |
In Section
Seekers of Perl Wisdom