user3767853
user3767853

Reputation: 293

Accessing data within a Perl variable

I dumped out a Perl variable called $prefs and got this:

$VAR1 = bless( {
                 'USERID' => 1286,
                 'PREFS' => {
                              '1' => {
                                       'VALUE' => 1,
                                       'OTHERS_POST' => 1,
                                       'CLIENTS_POST' => 1,
                                       'ASSIGNED_TASKS' => 1
                                     }
                            },
                 'dbh' => bless( {
                                   '_sth' => bless( {}, 'DBI::st' ),
                                   '_dbh' => bless( {}, 'DBI::db' )
                                 }, 'Taskman::DB' )
               }, 'USystems::UserPrefs' );

I'm pretty new to Perl, and I was wondering if someone can break down on whether or not it is possible to access specific data within this variable.

Like if I wanted to do an if statement such as

if (OTHERS_POST == 1) {
      // code }

How would I get to the actual OTHERS_POST inside the $prefs variable

Upvotes: 0

Views: 94

Answers (1)

Gingi
Gingi

Reputation: 2304

$prefs->{PREFS}->{1}->{OTHERS_POST};

Upvotes: 1

Related Questions