Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Re (tilly) 2: Fore!!! (was The Perl Review)

by blakem (Monsignor)
on Feb 02, 2002 at 00:14 UTC ( #142821=note: print w/replies, xml ) Need Help??

in reply to Re (tilly) 2: Fore!!! (was The Perl Review)
in thread The Perl Review

The y/// is very sneaky, but why play games with that $s? If you want a 0, see if one of $% $- $? or $[ work for you. Here it is shortened to 43 chars and as an added bonus, its now strict compatible.
# 1 2 3 4 #23456789_123456789_123456789_123456789_1234 $_=pop;y/A-Z/:-T/;$?=36*$?-48+ord for/./g;$?


Replies are listed 'Best First'.
Re (tilly) 4: Fore!!! (was The Perl Review)
by tilly (Archbishop) on Feb 02, 2002 at 00:44 UTC
    I wrote it as a function.

    The function should be usefully callable multiple times.

Re: Re: Re (tilly) 2: Fore!!! (was The Perl Review)
by Anonymous Monk on Feb 02, 2002 at 00:53 UTC
    Since you're well past my meagre 59 (from the use.perl thread), I might as well show it:
    $_=shift;y/0-9A-Z/\0-#/;(s/.//,($a*=36)+=ord)while length
    Yes, no output-- the game rules were unclear that way, too. Using your tricks I can get down to -- 43.
    $_=pop;y/0-9A-Z/\0-#/;($a*=46)+=ord for/./g
    If only the null byte were legal in y///, then the above could become 42...
    -- jhi
      Assuming that 46 is a typo...
      ($a*=36)+=ord # 13 chars $a=$a*36+ord # 12 chars
      But as you say, the rules are rather murky, so its tough to judge what qualifies as a solution and what doesn't.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://142821]
marioroy good night ;-), Happy New Year !!!
[marto]: night marioroy

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2018-01-23 10:11 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (242 votes). Check out past polls.