SilasTheMonk has asked for the wisdom of the Perl Monks concerning the following question:
The latest version hasfor (@_) { my $word = $_; $word =~ s/^#?\s*//;
So in the latest version we are modifying an element of the array of stopwords (which will tend to be an array of constants). In the old version the element was copied so there was no problem.for my $word (@_) { $word =~ s/^#?\s*//;
Now what is the real problem here? I thought the distinction between using $_ directly and copying it is a bit obscure, especially for non-critical code. I submitted a patch that does a non-modifying extraction via regex: rt://68471 but the module author simply proposes reverting. There is a comment in the code promising something more modern - so why not now. Also why does the code need to strip off spaces - surely that will happen anyway? Can someone explain why the problem goes away when I try to debug it?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problems with $_
by jethro (Monsignor) on May 26, 2011 at 09:33 UTC | |
by SilasTheMonk (Chaplain) on May 26, 2011 at 09:55 UTC |