in reply to Re: Dereferencing fetchall_arrayref({})
in thread Dereferencing fetchall_arrayref({})

Thanks Zaxo, I actually tried the $data[1][0] before the OP and was getting errors. So,I dropped in your code as is, but I still get the "is not an array reference" error. Data Dumper shows:

 $VAR1 = [  {  'title' => 'DRAGONFLY',  'scene' => 'DF'  },  {  'title' => 'HUMMINGBIRD',  'scene' => 'HB'  }  ];
Any other ideas? And yes, I meant uc, but have been reading up on MySQL functions :-)

—Brad
"A little yeast leavens the whole dough."

Replies are listed 'Best First'.
Re: Re: Re: Dereferencing fetchall_arrayref({})
by Zaxo (Archbishop) on Apr 25, 2004 at 20:55 UTC

    Try it with the dereferencing arrow, $data->[0][1]. What you show would apply to an AoA, not a reference to one.

    After Compline,
    Zaxo

Re: Dereferencing fetchall_arrayref({})
by b10m (Vicar) on Apr 25, 2004 at 20:59 UTC

    What about something like this?

    my $data; while ($_ = $sth->fetchall_arrayref()) { uc(${$_}{'title'}) if(${$_}{'title'} eq "large"); push @{$data}, $_; }
    --
    b10m

    All code is usually tested, but rarely trusted.
      You fell into the old uc trap. uc returns a value, it doesn't modify in place.


      Dave

        Ok, this then?

        ${$_}{'title'} = uc(${$_}{'title'}) if(${$_}{'title'} eq "large");
        --
        b10m

        All code is usually tested, but rarely trusted.