in reply to Re: Modifying a parameter to a recursive function
in thread Modifying a parameter to a recursive function
So in principle, you can modify a subroutine's arguments using the default variable $_ inside a foreach loop. Question is, why isn't it working inside his recursive function?@a = (1..10); sub x { foreach (@_) { $_++; } } x(@a); print @a; #prints 234567891011
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Modifying a parameter to a recursive function
by GrandFather (Saint) on Apr 08, 2009 at 21:42 UTC | |
by ikegami (Patriarch) on Apr 08, 2009 at 21:53 UTC |