David Garamond wrote: > > is there a short recipe to do this in perl? i want to replace all "die" > with "paint" and preserve case (i.e. "Die" should be replaced by > "Paint", "DIE" by "PAINT", and so on). there's a smart snippet on TPJ to > do this: > > $string =~ s/($x)/"\L$y"^"\L$1"^$1/ie; > > but it only works if the replacement string is of the same length.
This is a FAQ: perldoc -q "How do I substitute case insensitively" John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]