in reply to Subroutine performing operation on variable submitted to it...
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:
sub strip_tags{ my $string = shift; # Or my $string = $_[0]; $string =~ s/<[^>]+>//gs; return $string; }
With that method you're making a copy of the string and working on it.
Dave
|
|---|