If the snippets in the OP are what you're actually running, then I assume that either you did not 'use strict', or else you have a variable declared elsewhere called '$guid' and you are using it where you shouldn't be. Here's the problem in your first while loop:
my ($id, $accno) = split /\|/, $_;
push @{$hashList{$guid}}, $accno;
I think you want:
push @{$hashList{id}}, $accno;
As it is, all records in the first input are being pushed onto a single array. Then, in the second while loop, it may be you are running into that one string that matches the one hash key that contains the one big array. And this statement:
for my $accno (@{$hashList{$_}})
tries to make a copy of the array. Boom. (I can't be sure this is what's happening based on the small amount of info you gave, but it looks plausible.)
UPDATE: Actually, I'm not sure that the for-loop expression there is copying the array -- seems like it shouldn't have to. Still, you need to fix how the hash gets loaded.
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.