in reply to Re: Re: Re: matching every occurrence of a regex
in thread matching every occurrence of a regex
Well, the original messages stated that the protein sequence is "just a string of letters". From that I drew the conclusion that the whole thing is stored in a scalar. On rereading, maybe that's not so obvious anymore and my misinterpretation.
Concerning the localizing of $_, that's the right thing to do in certain circumstances. However, we are showing here snippets of code without context, presenting general ideas as you write yourself. We can't know whether it's reasonable to localize $_ or not, the author of the script has to decide that himself. You could point out, though, (as a general remark) that it might be a good idea to use local $_ if you are suspecting that the person asking might not be aware of that.
Update:When I'm talking about 'certain circumstances' I'm thinking about short scripts, acting similar to a unix filter with one main while (<>) {} loop. Localizing makes (most of the times) no sense there. However, ihb makes a very valid point for the more general case below.
I'd agree that we mostly agree ;-)
-- Hofmator
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Localizing $_ and while (<FH>) { ... }. (Is really: "Re: Re4: matching every occurrence of a regex")
by ihb (Deacon) on Jan 08, 2003 at 23:21 UTC | |
by IlyaM (Parson) on Jan 09, 2003 at 10:24 UTC |