in reply to Dereferencing fetchall_arrayref({})

Other people have provided the information you needed in this case, but you don't want to go seeking out help every time a reference doesn't work the way you imagine it should.

When $data->[1] did not return the type of values you anticipated, the next step is to find out what it does contain .... if your visualization of relaity and the contents of the data structure disagree, only one of them can be right. The appropriate solution at that point is to use Data::Dumper:

use Data::Dumper; print Dumper $data;

--
TTTATCGGTCGTTATATAGATGTTTGCA

Replies are listed 'Best First'.
Re: When data structures differ from your expectations
by bradcathey (Prior) on Apr 26, 2004 at 00:56 UTC
    TomDLux, you are absolutely right. I usually don't post until I have exhausted all avenues. I had forgotten about Data::Dumper, and once run, it showed me what I now understand is a AoH. I'm still working on understanding references (even after reading the Llama book).

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

      When I got into Perl, although I had a degree and many years of programming experience, it took me a long time to get used to complex data structures and references. I was used to C, where you have the structure declaration to refer to; since Perl can generate complex structures without any indication of what the arrangement will be, it can be hard to figure out.

      For the first six months, I mostly used data structures and references when I had to; the next six months I had to code-and-debug, a bit at a time, to figure out the appropriate code. By the end of the year, it had become part of me, I prefered passing a reference instead of a list, and then naturally stored that reference in an array or hash, and then stored a reference to that in ....

      Like all good things, data structures and references look like a long struggle when you're looking up at the learning curve, but it's definitely worth the effort.

      TomDLux

      --
      TTTATCGGTCGTTATATAGATGTTTGCA