On Fri, 2006-28-04 at 15:40 +0100, Graeme McLaren wrote:
> Hi all, I need to loop over an array of hashes and assign a new hashref if a
> condition is met:
>
> I have a scalar which contains an array of hashes:
>
> $locations = [
> {
> 'location_name' => 'Fionas House',
>
Hi all, I need to loop over an array of hashes and assign a new hashref if a
condition is met:
I have a scalar which contains an array of hashes:
$locations = [
{
'location_name' => 'Fionas House',
'location_id' => '0027'
},
{
Graeme McLaren wrote:
> Morning all, I have a problem that I can't see a way around. Basically
> I have an array of hashes and I want to get the key and value of each
> hash but with the following code I'm getting:
>
> Type of arg 1 to keys must be hash (not array element) at
> /usr/lib/perl5/ven
maybe u would try:
foreach my $key (keys %{$AoH[$map_loop{$i}]}) {
...
}
because $AoH[$map_loop{$i}] is just a ref,so u get wrong.
On Thu, 08 Sep 2005 09:42:33 +0100, "Graeme McLaren"
<[EMAIL PROTECTED]> said:
> Morning all, I have a problem that I can't see a way around. Basically I
> ha
Morning all, I have a problem that I can't see a way around. Basically I
have an array of hashes and I want to get the key and value of each hash but
with the following code I'm getting:
Type of arg 1 to keys must be hash (not array element) at
/usr/lib/perl5/vendor_perl/Purchaser/Common.pm l
On Fri, Jun 01, 2001 at 03:29:43PM -0700, Chuck Ivy wrote:
> First post, quick question:
>
> I've got an array of hashes that I'm defining the most basic way I can...
>
> my $gSeasonID;
> my @season_list = '';
> while (@fields = $sth->fetchrow_array) {
> $gSeasonID = $fields[0];
> $s
On Fri, Jun 01, 2001 at 03:29:43PM -0700, Chuck Ivy wrote:
> First post, quick question:
>
> I've got an array of hashes that I'm defining the most basic way I can...
>
> my $gSeasonID;
> my @season_list = '';
> while (@fields = $sth->fetchrow_array) {
> $gSeasonID = $fields[0];
> $s
First ugly thought goes like this:
my @season_list = '';
while (my @fields = $sth->fetchrow_array) {
for (my $i = 1; $i < @fields; $i++) {
$season_list[$fields[0]]{('number', 'title', 'active')[$i]} = $fields[$i];
}
Second thought is:
Why not use $sth->fetchrow_hashref? The only r
First post, quick question:
I've got an array of hashes that I'm defining the most basic way I can...
my $gSeasonID;
my @season_list = '';
while (@fields = $sth->fetchrow_array) {
$gSeasonID = $fields[0];
$season_list[$gSeasonID]{number} = $fields[1];
$season_list[$gSeaso