in reply to Pattern Matching: Case-Conservation

$s = 'foo FOO Foo fOO'; $s =~ s/(foo)/$1 ^ lc($1) ^ "bar"/gie; print $s,"\n"; # outputs "bar BAR Bar bAR"
This works as long as you are using ASCII and only matching alpha characters

Dave.

Replies are listed 'Best First'.
Re^2: Pattern Matching: Case-Conservation
by crazysniffable (Acolyte) on Jun 02, 2004 at 22:47 UTC
    Now that is some slick piece of coding... and exactly what I was looking for (in so many words). Big thanks!

    "Dogs love me cuz I'm crazy sniffable; I bet you never knew I got the ill peripherals."
    -- Beastie Boys