I am having a problem with returning multiple hashes from a subroutine. Specifically, I am unable to dereference the first of the returned hashes.
The subroutine, which is in a module, is declared as follows:
my ($marker_ranges_hashref, $clusters_hashref) = MyModule::MySub();
The hashes are returned from the subroutine as follows:
return (\%marker_ranges,\%finalMarkers);
and I am attempting to dereference them as follows (the hashes have already been declared earlier on):
%marker_ranges = %{$marker_ranges_hashref};
%clusters = %{$clusters_hashref};
When I comment out the first one or swap these two lines around, the second one dereferences fine (verified using the Data::Dumper). Switching the order of the hashes in the returned array has no effect (the second one works whichever hash it is, and the first one doesn't).
Attempting to dereference the first one produces the following error:
Can't use string ("HASH(0xa35c90)") as a HASH ref while "strict refs" in use at correlate_eQTLs.pl line 107..
Anyone know what's going on here?
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.