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

Anyone have any idea why I can't populate my array with the information from the variable array?
{ 'tree' => undef, 'macros' => undef, 'traps' => { 'xPnniNeighborFailure9' => { 'description' => '"An alarm indicating that a neighbor on a part +icular port has ceased communication with this switching system."' +, 'value' => '55', 'variables' => [ 'xPnniTrapNeighborId', 'xPnniTrapPnPortId' ], 'type' => 'TRAP-TYPE', 'enterprise' => 'omniswitch9' },
I'm trying to populate @trap_varbinds with the variable array like so:
@trap_varbinds = $name->{'traps'}->{'xPnniNeighborFailure9'}->{'variab +les'}->[];

Replies are listed 'Best First'.
Re: Data Structure Problem:
by cchampion (Curate) on Mar 10, 2003 at 20:34 UTC
    my @trap_varbinds = @{$name->{'traps'}->{'xPnniNeighborFailure9'}->{'v +ariables'}};
Re: Data Structure Problem:
by nite_man (Deacon) on Mar 11, 2003 at 15:09 UTC
    You can use array reference:
    $trap_varbinds_ref = $name->{traps}->{xPnniNeighborFailure9}->{variabl +es}; for(@$trap_varbinds_ref) { <do something ...> {

    ================
    { firstname => 'Michael',
    quote => 'Mice were crying and stinging but went on nibbling the cactus', }