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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |