in reply to Re^2: Case conversion
in thread Case conversion
Doesn't work, but close. Solution:Ouch! Just forgot that...
s/[aeiou]/$&^"\x20"/gei
And you used $&? ouch!Well, this comes out too often!! Most of times it's about the performance penalty. As far as the latter goes, perlre specifies clearly that it's the same as that involved in capturing and using numbered vars. So it's not a problem for me if I have to use what I matched in any case. But then the other common objection is that it's just plainly ugly. Then I reply that beauty is in the eye of the beholder, and I don't find it to be quite that disturbing.
s/([aeiou])/$1^"\x20"/gei
Granted: a variable name like $& is not that beautiful either, and IMHO it doesn't convey the psychological feeling of referring to what has been matched (Hopefully Perl6 will be better at this, but we still have to wait...) - as a side note there are situations, albeit not common ones, in which I'd like it to be $_: it's the topicalizer, and I say "match this, then substitute it with that (possibly depending on it)".
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Case conversion
by ikegami (Patriarch) on Sep 02, 2005 at 14:08 UTC | |
by blazar (Canon) on Sep 02, 2005 at 15:01 UTC |