in reply to Re: Globally change ucfirst in mod_perl
in thread Globally change ucfirst in mod_perl

No, \u is ucfirst, \U is uc. Interestingly, either will work in redefining ucfirst. Perl knows that \u means Perl's own ucfirst, even if ucfirst has been redefined.
BEGIN { *CORE::GLOBAL::ucfirst = sub { join ' ', map "\u$_", split / /, @_ ? $_[0] : $_; } } $_ = "one two 'three' four\n"; print "\u$_"; print ucfirst;
And in fact, my original suggestion even works! Perl is way ahead of the DWIM curve.
BEGIN { *CORE::GLOBAL::ucfirst = sub { join ' ', map ucfirst, split / /, @_ ? $_[0] : $_; } } $_ = "one two 'three' four\n"; print "\u$_"; print ucfirst;
Update: fixed default-as-$_ code.

The PerlMonk tr/// Advocate