in reply to ucfirst(uclast(lc($user))) ?

(This title of this posting is a joke, I know there isn't uclast )

sub uclast ($) { my ($foo) = @_; $foo =~ s/(.)$/uc $1/e; return $foo; }

Now there is :)

44696420796F7520732F2F2F65206F
7220756E7061636B3F202F6D736720
6D6521203A29202D2D204A75657264

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

    /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; }

      /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
      

Re: Re: ucfirst(uclast(lc($user))) ?
by theguvnor (Chaplain) on Mar 09, 2002 at 15:58 UTC

    Nice!

    ..Guv

    Update: totally baffled as to why complimenting Juerd's solution would possibly garner me a --. Feel free to /msg me to 'splain the error of my ways.

      I learned this when I posted a "your welcome" post...

      Redundant posts normally get -- by monks that wish to keep the signal to noise level down, nothing personal I think. I myself now sometimes -- posts that offer the same solutions offered by previous posts hours ago. How many "use CGI.pm, use strict, use warnings" posts do you need ? ++ the first few and -- the "me too" posts.

      In any event, your update seems to have awaken the human side in some :)

      Tiago