I don't think that is really the OP's problem. What you suggest can be checked trivially by:
use strict; use warnings; my @array = (1 .. 8); print "Before: @array\n"; nastyModifyParamsSub (@array); print "After: @array\n"; sub nastyModifyParamsSub { for my $element (@_) { ++$element; } }
Prints:
Before: 1 2 3 4 5 6 7 8 After: 2 3 4 5 6 7 8 9
Which shows that modifying the parameters is possible and that there is nothing magical about requiring $_ to do it. The following though shows one way that OP's code could be going awry:
use strict; use warnings; my @array = (1 .. 8); print "Before: @array\n"; nastyModifyParamsSub (@array); print "After: @array\n"; sub nastyModifyParamsSub { for (@_) { ++$_; clobberDefVar (); } } sub clobberDefVar { $_ = 0; }
Prints:
Before: 1 2 3 4 5 6 7 8 After: 0 0 0 0 0 0 0 0
The bottom line though to that the OP's description is an fuzzy unclear thing and there is too much code and no data at all.
In reply to Re^3: Modifying a parameter to a recursive function
by GrandFather
in thread Modifying a parameter to a recursive function
by CoDeReBeL
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |