how to get individual array element from perl -


following output of dumper($resultset);

$var1 = bless( {                  'rows' => [                              bless( {                                       'columns' => [                                                      bless( {                                                               'columnname' => 'tableschemaname',                                                               'columnvalue' => 'from_perl'                                                             }, 'abc::tcolumn' )                                                    ]                                     }, 'abc::trow' )                            ]                }, 'abc::tresultset' ); 

how iterators on columns arrays.

the data want access encapsulated in object of type abc::tresultset. class should have api allow access members. bad idea circumvent encapsulation, if quite easily.


if weren't dealing objects nested data stuctures, can retrieve arrayref want, , dereference loop on it:

for $row (@{ $var1->{rows} }) {   $cell (@{ $row->{columns} }) {     ($name, $value) = @{$cell}{qw/columnname columnvalue/}; # hash slice     ...;   } } 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -