Problems? Is your data what you think it is? | |
PerlMonks |
Re: Subroutine performing operation on variable submitted to it...by davido (Cardinal) |
on Nov 24, 2011 at 07:41 UTC ( [id://939814]=note: print w/replies, xml ) | Need Help?? |
The answer is in perlsub. $_[0] becomes an alias to the sub's parameter. In this case, that param is $item->{'title'}, so the change ripples back as you've experienced. Do it this way:
With that method you're making a copy of the string and working on it. Dave
In Section
Seekers of Perl Wisdom
|
|