in reply to Copy an object

A bit more of an expansion on my comment above...
# untested! just off top of head my $db = 'DBI:mysql:database=db;host=host'; my $user = '...'; my $pass = '...'; my $result = db_query('select * from table'); my $dbh; sub db_query { my $sql = $_[0]; $dbh = DBI->connect_cached($db, $user, $pass); my $sth = $dbh->prepare($sql); $sth->execute(); my $result_hashref = {}; while (my $ref = $sth->fetchrow_hashref()) { $result_hashref->{ $ref->{'id'} } = $ref; } $sth->finish(); return $result_hashref; } sub DESTROY { if (defined $dbh) { $dbh->disconnect(); } }
Is this the sort of thing you're looking for?

.02

cLive ;-)