in reply to How to preserve all instances from a database in an array?
use strict; use warnings; our @saveForLater = (); our $cursor = $db->prepare("select recno,name from TABLE;"); $cursor->execute(); while(my ($recNo, $name) = $cursor->fetchrow()) { # Do something with results ... # Save data for further processing push @saveForLater, [$recNo, $name]; } ... # Later in the program foreach my $refToRow (@saveForLater) { print "Record No. - $refToRow->[0]\n", "Name - $refToRow->[1]\n"; # Or whatever you want to do. }
I hope this is of use.
Cheers,
JohnGG
|
|---|