ciao a tutti
ho una sub che crea un array di hash cosi:
codice:
sub getSources {
my $query = "select id, url from sources";
my $sth = $db->prepare($query);
$sth->execute;
my @arr_sources = ();
while (my $recset = $sth->fetchrow_hashref) {
my $hash_sources;
$hash_sources{id} = $recset->{id};
$hash_sources{url} = $recset->{url};
push(@arr_sources, \$hash_sources);
}
$sth->finish;
$db->disconnect;
return \@arr_sources;
}
richiamo la sub ma non riesco ad accedere ai valori:
codice:
my @arr_sources = &getSources();
foreach my $source (@arr_sources) {
print $source->[0];
}
come posso fare ad accedere ai vari hash e stampare i valori?
grazie 1000