Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Base36 numbers: speed and golf

by japhy (Canon)
on Feb 27, 2002 at 19:52 UTC ( [id://148012]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    {
      my @to_b36 = (0 .. 9, 'A' .. 'Z');
      my %to_num;
    ...
    
      sub inc_b36 { num_to_b36(&b36_to_num + 1) }
    }
    
  2. or download this
    {
      # in the same block as the previous code
    
    ...
        return $n;
      }
    }
    
  3. or download this
    {
      # ditto
    
    ...
        return scalar reverse $n;
      }
    }
    
  4. or download this
    sub GOLF {
    local$_=pop;@_{@_=(
    0..9,A..Z)}=0..35;s
    ...
    $1}+1].$-x length$2
    /e?$_:1 .$-x y!!!c
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://148012]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-19 11:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found