Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Dear monks,
Please help me understand the Dumper output. This Dumper output is of a scalar that I get from set_sql method of DBI::Class.
I want to know
1) the meaning of each BRACKET ie which means what in this context qw _ ( { [ {},{},{} ] } )
2) Which hash of hash/hash of arrays ?? How to call these (qustion 1,2 are pointing to same thing)
3 How can I push values of each row eg ( 101,John,Scoial_science ) in an array one by one. Following is the Dumper output of scalar from search_set_sql .
$VAR1 = bless( { '_data' => [ { 'student_id' => '101', 'student_name' => 'John', 'stream' => 'Social_science', }, { 'student_id' => '102', 'student_name' => 'Smith', 'stream' => 'History', } ], '_place' => 0, '_mapper' => [], '_class' => 'School::Block::Student' }, 'Class::DBI::Iterator' );
Please help me to come out of this confusion.

Edit: g0n - code tags in 1)

Replies are listed 'Best First'.
Re: Understanding Dumper out put
by Joost (Canon) on Dec 15, 2007 at 15:52 UTC
    The most important thing to note is that you're dealing with not a plain nested data structure, but an object. You can see that from the bless( ...., "'Class::DBI::Iterator'); statement surrounding the data structure.

    The last item in the bless call is the class of the object, in this case Class::DBI::Iterator. If you weren't aware of that, see the docs for that class first.

    As for the strucure:

    { 'x' => y } creates a hash reference with 'x' as a key an d y as the value
    [ ... ] creates an array reference
    0 is a number
    [] is an reference to an empty array

    See also perlreftut