Pathologically Eclectic Rubbish Lister | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
see Markup in the Monastery before putting code
the problem is that the data in the final array(result array) is getting over written and not appended. please help me out.... :( what you mean by final array here? one more hint, every time inside the forloop you are using so may intermediate variables and it will get overwritten. try printing those values inside the for loop and ensure that it prints properly, rather than seeing the values after the for loop. according to your code the variables $err_loan_id1,@err_loan_id2,$reqd_1,@err_loan_id3,$reqd_2,@err_loan_id will have the values that belong to the last file in the array @cad_err_list if you print the values at the end of for loop if you need only the final array then just have a hash declared at a global scope and maintain the intermediate variables like this. now for every file the final array is saved, you can print at the end of for loop, try printing using Data::Dumper::Dumper you will recognize the output clearly now similarly if you want to save all the intermediate values do like this inside your for loop. I think I have answered your question..
but you will end up in using more memory if you have so many files in @cad_err_list and because of that if the values in the intermediate variables are huge, then plainly using the methods shown by me is prone to problems, take care.
Vivek -- In accordance with the prarabdha of each, the One whose function it is to ordain makes each to act. What will not happen will never happen, whatever effort one may put forth. And what will happen will not fail to happen, however much one may seek to prevent it. This is certain. The part of wisdom therefore is to stay quiet. In reply to Re^3: appending multiple values in an array
by targetsmart
|
|