in reply to Data Dumper help

will a $VAR1->{nodes}->{attCNMds1StatusIndex}->{description} work?
He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.

Chady | http://chady.net/

Replies are listed 'Best First'.
Re: Re: Data Dumper help
by Anonymous Monk on Feb 28, 2003 at 18:15 UTC
    my Dumper line looks like this:
    my $name = $mib->compile('att_ds1'); print Dumper($name);
    How do I do that using $name?
    Thanks
      $name->{nodes}->{attCNMds1StatusIndex}->{description}

      As a side note, with such complex data structures, I frequently find the output hard to read unless I tweak the indent:

      my $name = $mib->compile('att_ds1'); $Data::Dumper::Indent = 1; print Dumper($name);

      The output is then similar to the following:

      $VAR1 = { 'tree' => { 'att-products' => { '9' => 'att-cnmAgent' }, 'attCNMds1ErrorsTable' => { '1' => 'attCNMds1ErrorsEntry' }, 'attCNMds1ErrorsEntry' => { '9' => 'attCNMds1ESs', '1' => 'attCNMds1ErrorsIndex', '2' => 'attCNMds1ErrorsInterval', '3' => 'attCNMds1ErrorsTimeStamp' }, 'enterprises' => { '74' => 'att-2' }, 'attCNMds1StatusTable' => { '1' => 'attCNMds1StatusEntry' }, 'attCNMds1StatusEntry' => { '1' => 'attCNMds1StatusIndex', '2' => 'attCNMds1LineStatus' }, 'att-2' => { '1' => 'att-products', '2' => 'att-mgmt' }, ###

      Cheers,
      Ovid

      New address of my CGI Course.
      Silence is Evil (feel free to copy and distribute widely - note copyright text)

        That is handy,
        Thanks for the tip!
        I'm still getting this error:
        syntax error at C:\mibs.pl line 29,near "}->"
        using :
        $mib->load('att_ds1'); my $name = $mib->compile('att_ds1'); print $name->{nodes}->{attCNMds1StatusIndex}->{description};
        If you want concise output, you might try my module Data::XDumper instead: it tries to dump sub-structures on a single line whenever possible without exceeding some (configurable) line length.

        More like:

        { tree => { 'att-2' => {1 => 'att-products', 2 => 'att-mgmt'}, 'att-products' => {9 => 'att-cnmAgent'}, attCNMds1ErrorsEntry => { 1 => 'attCNMds1ErrorsIndex', 2 => 'attCNMds1ErrorsInterval', 3 => 'attCNMds1ErrorsTimeStamp', 9 => 'attCNMds1ESs' }, attCNMds1ErrorsTable => {1 => 'attCNMds1ErrorsEntry'}, attCNMds1StatusEntry => { 1 => 'attCNMds1StatusIndex', 2 => 'attCNMds1LineStatus' }, attCNMds1StatusTable => {1 => 'attCNMds1StatusEntry'}, enterprises => {74 => 'att-2'} } }
        (this is with prefix set to "" because you don't have any cross-references, and a reduced maximum line length)