Like
duff says, we're going to need to see the code. The same code should yield the same results. There may be subtle differences outside of the code you cut and pasted, though, like what $/ is set to, how the subroutine closes, etc.
For what it's worth, here's how I ended up getting around the hash-in-scalar-context problem with reading in Data::Dumper files:
sub parse_hist {
local $/ = undef;
%sess_hist = %{do($hist_file)};
}
In this case, %sess_hist is the last thing in the subroutine, so that should be what is returned. In my code, parse_hist was called in void context and %sess_hist was a global variable, so it didn't matter how stuff got returned (except that I'm probably wasting memory and cycles).
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.