Dave Thomas wrote: > "Conrad Schneiker" <schneiker / jump.net> writes: > > > > Hmm, although I think options i, s, m, o, and x should belong to > > > regexp, I can understand your opinion. > > > > Could g belong to regexp as well? > > If 'g' was an attribute of Regexp, then what would > > line =~ /asdf/g > > mean? Someone else has aready partly answered this, however, from Programming Perl, 2nd ed., p. 71: (1) ".... In a list context, it returns a list of all the substrings matched by all the parentheses in the regular expression. If there are no parentheses, it returns a list of all the matched strings, as if there were parentheses around the whole pattern." (2) "In a scalar context [it] iterates through the string returning true each time it matches, and false when it eventually runs out of matches. ..." For Ruby, I think something like the first behavior might be appropriate, but not the second (which I think has a little too much Perl magic), and for which I think Ruby has the superior solution. > You know, I've been using Perl for years, and awj before that. I must > have written thousands if pattern matches. And I can't think of a > single case where I've needed to change a match from 'once' to > 'global' at runtime. I'm not sure what this has to do with the previous discussion. But out of curiosity, did you ever change any of the other flags at runtime? > So I'm wondering: what are we discussing here? Well, you've got me wondering now too. :-) IIRC, this branch of the thread began when I expressed (insufficiently clearly) my preference for regarding and writing substitution expressions using a single substitution method with various options versus regarding and writing substitution expressions in terms of different substitution methods. Conrad Schneiker (The opinions in this note are unofficial and subject to improvement without notice.)