in reply to TreePP (Hash or Array)

Are you talking about XML::TreePP? You can use ref to check the return type: if it's an array, OK; if it's a hash, put it into an array; continue processing.

You may want to contact the author to see if this could be handled better in the module, or perhaps there is reason behind the behavior.


Update: Kudos to davorg for reading the docs :)

Replies are listed 'Best First'.
Re^2: TreePP (Hash or Array)
by bitman (Scribe) on Jan 15, 2007 at 16:49 UTC
    Except, it didn't work. But I used your solution, but I guess my code isn't that elegant though.
    if ( ref $tree->{$xfile}->{$rec} eq 'HASH' ) { my $x=$tree->{$xfile}->{$rec}; delete $tree->{$xfile}->{$rec}; $tree->{$xfile}->{$rec}[0]=($x); }
      force_array did not work? Is it not what it seems to be, a bug, or, upon second glance, a (gasp!) user error?