in reply to Re: [perlre/perlgolf] Golf: Sunset strip!
in thread [perlre/perlgolf] Golf this: return -1 or return +1 on regexp subroutine please

Still broken!

sub by_priority{my$r=qr/^(?:Service|Organisation|FAQ)/;$a cmp$b|($a=~$ +r&-1)+($b=~$r)} my @foo =( "Service", "FAQ", "BrowserUK","Organization1", "FAQ2", "Org +anization2"); print join " ", sort by_priority @foo; __END__ BrowserUK FAQ FAQ2 Organization1 Organization2 Service

This turns into an alphabetical sort!

Replies are listed 'Best First'.
Re: Re: Re: [perlre/perlgolf] Golf: Sunset strip!
by BrowserUk (Patriarch) on Nov 01, 2002 at 00:28 UTC

    Update: Fixed the data and the code above.

    Okay. All my non-prioritised items started with lower case, so they got sorted last. D'oh!

    Evidence for the defence.


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