in reply to help with a regexp

Don't use a regexp, you don't need it and it'll only make things more complicated. Just alter each character individually.

for (0, -1) { $bar = substr $foo, $_, 1; $foo = substr($foo, $_, 1) = uc bar; }

Replies are listed 'Best First'.
Re: Re: help with a regexp
by Dedalus (Scribe) on Sep 26, 2002 at 21:32 UTC
    But if you really do want to use a Regex the following will work and does so for the special cases of one or two letter words.
    s/\b\w|\w\b/\U$&\E/g
    or if you don't want "toasted weasels" to go to "ToasteD WeaselS" but "Toasted weaselS" then:
    s/\A\w|\w\z/\U$&\E/g
    Dedalus.