I have a script that contains a subroutine that takes a file, does some analysis, reads the results into two separate hashes and then returns the hashes to the main program. Or so I thought.
When I do this in the subroutine just before sending the hashes back to the main program, it prints out the contents correctly
for my $key (keys %$tData)
{
my $value = $tData{$key};
print "overlap: $key $value\n";
}
I then send the hashes back to the program thus
return($tData, $aData);
The subroutine is called in the main program as follows:
my ($tOVERLAPData, $aOVERLAPData) = getOVERLAPData($fOVERLAP);
And then try to print out the contents of the same hashes within the same program but it seems that the hashes aren't being returned as I'm not getting any print out of the content.
Can anyone suggest why this might be so? I know i haven't given you much code but I'm assuming I've just done something rather silly as returning a hash should be a trivial process should it not? The hashes DO exist in the subroutine and i can print out the contents just fine - I just can't get to them in the main program.
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.