in reply to Re: ucfirst(uclast(lc($user))) ?
in thread ucfirst(uclast(lc($user))) ?

/e is a bit excessive here, isn't it? :) Also, you may want to only match against (\w) instead of (.). No reason to try to uppercase a funny character!

sub uclast ($) { my $foo = shift; $foo =~ s/(\w)$/\u$1/; return $foo; }

Replies are listed 'Best First'.
Re: Re: Re: ucfirst(uclast(lc($user))) ?
by Juerd (Abbot) on Mar 09, 2002 at 23:24 UTC

    /e is a bit excessive here, isn't it? :)

    No, I don't think it is. I dislike using interpolation when there's only a single variable being used and no literal text. Great when golfing, but just annoying line noise otherwise.

    Also, you may want to only match against (\w) instead of (.).

    Good point. I thought \w was not affected by using locales, but it is.

    44696420796F7520732F2F2F65206F
    7220756E7061636B3F202F6D736720
    6D6521203A29202D2D204A75657264