in reply to English Date-Suffixes

There are still a couple of loose ones in there. -2 or -3 if you count the superfluous ;

($£=pop)=~/1./?0:qw(0 st nd rd)[$£%10]or'th'

My best alternate ain't even close, substr is too long.

sub nthit{ substr'thstndrd',($£=pop)=~/1./||($£%=10)>3?0:2*$£,2 }

Nah! Your thinking of Simon Templar, originally played by Roger Moore and later by Ian Ogilvy

Replies are listed 'Best First'.
Re: Re: English Date-Suffixes
by John M. Dlugosz (Monsignor) on Nov 04, 2002 at 21:32 UTC
    What's with the accent marks and sterling pounds? I read that as a variable name, but why use two chars for an arbitrary name? Must be something special, or something else that got displayed wrong.

      In essence, any single char scalar name would do.

      I started using $£ as a variable name in golf-type solutions as its the only punctuation global that isn't used for something somewhere by Perl itself, therefore it doesn't cause warnings with strict, and I don't have to localise it.

      Quite why one instance of the £ character got converted during the process of posting the code, and none of the others did I am not quite sure. I even tried to correct it by cut&pasting one of the others that shows correctly (in my browser at least) over the top of the one that comes out wrong, but the results where always the same. I have no idea how to correct it.


      Nah! Your thinking of Simon Templar, originally played by Roger Moore and later by Ian Ogilvy
        I'm seeing "the £ character" as two glyphs everywhere in your post: Capital letter A with Circumflex, and Pound Sign.

        0xC3 0xa3 looks like valid UTF-8, in that the first begins with 110... and the second is 10... bits. So Unicode E3 is what you typed? that's Small letter a with Tilde, which isn't a particularly unique character so I don't think that's what you were referring to.

        So what character is supposed to be there?

        How to correct: use the HTML Entity name. Then it's either correct or "escaped out but obvious what was meant" no matter what code page the browser is using. It also might make sence for the PM pages to bear a charset indicator so that browser doesn't have to guess.

        —John