in reply to Array of Hashes population

You probably want to add a hash reference (a scalar) to the end of your array,
push @data, \%tmp;


You might prefer to return a array reference for speed.

Replies are listed 'Best First'.
Re^2: Array of Hashes population
by barakuda (Initiate) on Mar 06, 2008 at 17:04 UTC
    Wow! That's beautiful :) Thank you! So, you can't actually have an array of hashes, only an array of hash references?

      Correct; elements of Perl arrays and hashes must be scalars. One "converts" a variable (@array, %hash) into a reference to a variable by prefixing a backslash(\), so the reference to @array would be \@array. I believe that references can also point to subs, which means that one could have an array which has elements that are, variously, references to hashes, references to arrays, references to subs, references to scalars, and actual scalars.


      emc

      Information about American English usage here and here.

      Floating point issues? Read this before posting: http://docs.sun.com/source/806-3568/ncg_goldberg.html