develooper Front page | perl.fwp | Postings from March 2002

Re: TPR1 post-mortem

Thread Previous | Thread Next
From:
Stefan `Sec` Zehl
Date:
March 8, 2002 06:56
Subject:
Re: TPR1 post-mortem
Message ID:
20020308145521.GA25147@matrix.42.org
On Fri, Mar 08, 2002 at 03:16:10PM +0100, Marcelo E. Magallon wrote:
>  As you can see it's just a series of 1 .. 9, except for 0.  With that
>  in mind my first I tried something like (0,(1..9)x11)[$n].  Actually,
>  before that I tried something more like (0,(1..9)x2)[$a+$b] (where $a
>  and $b are the digits).

I also tried (1..9)[$a+$b-10] which works fine except for a=b=0. But it
is as long as the more obvious $a+$b-($a+$b>9)*9 which a few more people
have.

CU,
    Sec (58 characters and a first time golfer)
    
P.S.: But i got help from a friend, as I couldn't figure out why
      /.(?=.)/ or /.((?=.))/ wouldn't set $1. Silly me, as obviously a
      zero-width-something doesn't return anything :)
-- 
To paraphrase RFC1925:
        Time, talent, willingness: Pick any two.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About