From: Paul van Delst Date: 2006-10-21T01:40:18+09:00 Subject: Re: Problem modifying captured regexp results Gavin Kistner wrote: > From: Paul van Delst [mailto:Paul.vanDelst@noaa.gov] >> So can someone elaborate on why the above split operation on >> captured regexp results seems >> to bugger up the other captured results? Does this issue >> extend to *any* operation on >> captured regexp results? > > That's what you get for using the (thread-local) global variables that > change with each regexp operation. > > Regexp.match returns a MatchData object that will allow you to save your > results from a previous operation and not have them changed by later > code. Hello, I agree with what you're saying. I actually have already switched to MatchData objects rather than the $-variables -- for all the usual reasons. So, while my initial question may be less interesting now (since I have working code), I'm still curious why in the statement arrayList<<{"type"=>$1, "param"=>$2, "dimlist"=>$3.split(/\s*,\s*/), "name"=>$4, "description"=>$5} operation on $3 modifies $4 and $5? (And, similarly, operation on $1 would "clear" $2 to $5) Based on your first sentence, I guess I have an updated question: Does using the split method on a $-variable count as a "regexp operation"? cheers, paulv -- Paul van Delst Ride lots. CIMSS @ NOAA/NCEP/EMC Eddy Merckx Ph: (301)763-8000 x7748 Fax:(301)763-8545