in reply to Re: Globally change ucfirst in mod_perl
in thread Globally change ucfirst in mod_perl
And in fact, my original suggestion even works! Perl is way ahead of the DWIM curve.BEGIN { *CORE::GLOBAL::ucfirst = sub { join ' ', map "\u$_", split / /, @_ ? $_[0] : $_; } } $_ = "one two 'three' four\n"; print "\u$_"; print ucfirst;
Update: fixed default-as-$_ code.BEGIN { *CORE::GLOBAL::ucfirst = sub { join ' ', map ucfirst, split / /, @_ ? $_[0] : $_; } } $_ = "one two 'three' four\n"; print "\u$_"; print ucfirst;
|
|---|