in reply to Re: Re: recomendations needed for type of data structure
in thread recomendations needed for type of data structure

This is because the array of traps is stored as a reference to an anonymous array in one of the keys (TRAP_LIST) of the anonymous hash in the TRAPS key of the %$hash. This means that when you try to print the keys and values of the %{$hash->{TRAPS}} hash, you get the stringified array reference. To solve this you could add a special case to the output loop which prints the contents of the array.
# this handles ARRAYs and HASHes # you may want to use Data::Dumper for debugging however # the final code for processing the data structure will # also be less generic than this code. if (ref $value eq 'ARRAY') { print "$key => (@$value)\n"; } elsif (ref $value eq 'HASH') { print "$key => (%$value)\n"; } else print "$key => $value\n"; }

--
integral, resident of freenode's #perl

Replies are listed 'Best First'.
Re: Re: Re: Re: recomendations needed for type of data structure
by Anonymous Monk on Feb 17, 2003 at 21:09 UTC
    Thank you Integral
    One last question,

    What would the syntax be if I wanted to simply print out?:

    Varbind: 1.3.6.1.2.1.2.2.1.1
    Thanks again, I'm slowly piecing this all together.
      Well assuming that $key = 'Varbind' and that $value is an array ref containing each part of the id, then you can use join:
      print "$key: ".join('.',@$value)."\n";

      When you use an array in a string (like "@a"), perl translates this internally into join($", @a), one can see this if you turn perl's bytecode back into source code using B::Deparse.

      --
      integral, resident of freenode's #perl
      
Re: Re: Re: Re: recomendations needed for type of data structure
by steves (Curate) on Feb 17, 2003 at 21:49 UTC

    Exactly ... that's part of what needs finishing. My laziness got the best of my hubris. 8-)