in reply to Need Help Understanding Parsing XML into multi level struck

While you're fixing up spelling mistakes, "struckt subField"? "struck Field"?

Have you considered verifying whether $tree->{level1}->{level2}->{$item} and $tree->{level1}->{level2}->{$item}->{subItem} exist, before accessing them?

If $self is a reference to a hash, what is $self->$item, $self->$item->$subItem? A subroutine, I guess, since it's invoked and passed $tree->{level1}->{level2}->{$item}->{subItem}.

--
TTTATCGGTCGTTATATAGATGTTTGCA

  • Comment on Re: Need Help Understanding Parsing XML into multi level struck

Replies are listed 'Best First'.
Re: Re: Need Help Understanding Parsing XML into multi level struck
by ralibm (Acolyte) on Mar 18, 2004 at 00:23 UTC
    Definetly dumped the $tree once I started having problems.

    I'm also using 'use strict', so spelling isn't an issue with the code.

    I copied/pasted the tree output into the source in case I had mis-spelled a field name or list item.

    I've exashed my O'Reilly cookbook for every example that I could canibalize, plus what I could find off CPAN examples.

    I've scrubed the code and I can send it to you to pour over. It's not very big, just over 100 lines, mostly for clarity.
      Sorry I didn't awnser the other half of your question.

      $self is a ref to the Field structure. $self->$item is a ref to one of the keys in Field, dependant on the looping. $self->$item->$subItem is a ref to one of the keys in SubField for Field, again depending on the iteration of the loops.

      This is a ref to the value in the tree at $subItem for $item for Level2 for Level1.

      $tree->{Level1}->{Level2}->{$item}->{$subItem}

      This is supose to act as a setter for $self. $self->$item->$subItem ( ) ;

      Simply put, you get $subItem from tree and place it into $subItem of $self.
        If I'm understanding you correctly, you're not using proper syntax for hash references. If $self is a HASH ref, and $item is a key, then $self->{$item} and not $self->$item are what you want.