Same error as before: 'Not a HASH reference at line 12' (which is: push @{$ret},join '|',).

The statement isn't over, keep following the comma

push @{$ret},join '|', $_->{Hit_def}, ## HASH ACCESS $_->{Hit_num}, ## HASH ACCESS $_->{Hit_hsps}->{Hsp}->{Hsp_identity}; ## HASH OF HASH OF HASH +ACCESS

So is it related to the input file?

Absolutely, sometimes a Hit_hsps doesn't have a Hsp_identity or an Hsp ... if the data isn't there its not there

You can cure death with judicious use of block eval and subroutines and Data::Diver :) See Re: Parsing SOAP::Lite results (with Data::Diver), Re: $var{el} += 1 vs $var{el} = $var{el} + 1, Re: Problem with counting the nodes in a hash created by XML::Simple (use XML::Rules, Data::Diver )

So is it related to the input file? Maybe my XML file is somehow messed up.

Yes, its because you're using XML::Simple when you want to use XML::Rules

XML::Rules does by default what folks expect from XML::Simple

See examples Re: XML::Simple Not getting the proper output. ( xml2XMLRules, Re^3: Parsing XML (XML::Rules xml2XMLRules )

The more files you give xml2XMLRules the better the rules it spits out for you to plug into XML::Rules, the more stable the resulting data structure

... ? ... ! ...

You can always use rehohy to visualize your data like Re^3: Parsing a JSON response, Re: A "simple" question regarding accessing a value in a complex data structure., Re^2: Array of structures within an array of structures.

See also references quick reference, hashes are curly
Re: How to traverse a two dimentional array in a constructor?, Re: Parsing SOAP::Lite results,, Re: Trouble accessing Hash of Arrays (troubleshooting basics),
Re^5: Combining 3 files,


In reply to Re^7: multiple XML fields in one line by Anonymous Monk
in thread multiple XML fields in one line by smice

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.