On Sat, Feb 19, 2011 at 9:22 AM, Jerry Kaidor <[email protected]> wrote: > >> my @ids_ary = []; > >> my @names_ary = []; > >> my @age_ary = []; > > > > Why do you need an empty arrayref as the first element of these? > > *** Really don't. Just habit from 20 years of C programming. I also > pre-initialize scalars. Helps me read the stuff 6 months later. >
You missed the point. By using [] you are creating an anonymous array and assigning that to element 0 of each array. You want () not [] for initializing arrays. But why not just use selectall_arrayref methods and get a 2-dimensional structure in one go? http://search.cpan.org/~timb/DBI-1.616/DBI.pm#selectall_arrayref -- Check out my LEGO blog at http://www.brickpile.com/ View my photos at http://flickr.com/photos/billward/ Follow me at http://twitter.com/williamward
