in reply to Re^2: WHAT IS WRONG TO PASS PARAMETER TO THE ARRAY?
in thread WHAT IS WRONG TO PASS PARAMETER TO THE ARRAY?
If you are certain the input to your subroutine is correct but your subroutine is returning an incorrect result then your subroutine is not written correctly. I can't help you fix the problem because you haven't shown me what input the subroutine receives or what result it must return. My uncertainty is only increased by the difference between the code in your original post and that in your recent post.
You might find brian's Guide to Solving Any Perl Problem helpful. It has some good advice about how to find and correct the causes of errors.
I can only help you further if you post what your input is and what your output must be. The best way to show this would be to present perl code which produces the required data structures, similar to what Data::Dumper produces. For the subroutine input, it would be best if your put the following at the beginning of your subroutine, before anything else in your subroutine, and posted the output.
{ use Data::Dumper; my $log = "/tmp/log.txt"; # change to some convenient path open(my $fh, '>', $log) or die "$log: $!"; print $fh, Dumper(\@_); close($fh); }
If you post what gets written to the log file, then I will at least know what the input to your subroutine is.
To determine what the output should be, you can write a subroutine which ignores its input and returns a constant data structure which produces useful/correct output. Then you can use Data::Dumper to dump this data structure and post it.
If you do this, I might be able to help you further. Otherwise, I wish you good luck with Brian's advice.
|
|---|