Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
An amusing little test suite. The assorted strings in q!! are various peoples golf attempts from here and use.perl.org's article.
#!/usr/bin/perl -w use Test::More qw/no_plan/; use strict; my%v=( '1' => 1, '4' => 4, 'A' => 10, '0' => 'zero', 'B' => 11, 'Z' => 35, 'AA' => 370, '1F' => 51, '03F' => 3*36+15, 'BF' => 11*36+15, '2B3F' => 107691, ); foreach my$g( q!y/0-9A-Z/\0-#/;($a*=36)+=ord for/./g;$a! , q!map{$t+=(ord()-(/\d/?48:55))*36**$l++}reverse split//,pop;$t! , q!map{$t+=(ord()-(/\d/?48:55))*36**$l++}reverse split//,shift;$t! +, q!$a+=$_*36**$b++for reverse map/\d/?$_:ord($_)-55,pop=~/./g;$a! , q!($_,$s)=@_;y/A-Z/:-T/;$s=36*$s-48+ord for/./g;$s! , q!y/A-Z/:-T/;$a=36*$a-48+ord for/./g;$a! , q!$a+=(-55+/\d/*7+ord)*36**$b++while$_=chop$ARGV[0];$a! , q![map$a+=(/\d/?$_:-55+ord)*36**$b++,reverse pop=~/./g]->[-1]! , q!$n=ord(pop);$a=($n>>6)?(($n&31)+9):($n&15);! , q!eval join"+",map{$_=(-55+ord uc);$_+=6if/-/;"$_*36**".$i++}rever +se split('');!, q!map$d=$d*36+(/\d/?$_:-55+ord),pop=~/./g;$d! , q!$b=$b*36-48-7*/\D/+ord for pop=~/./g;$b! , q!sub x{$_&&-7*/\D$/+ord(chop)-48+36*&x}x$_! , #q!$n=pop;for(;$n ne((0..9),(A..Z))[$a];$a++){}"$a"||0;! , ){while(my($i,$n)=each%v){my$o=eval"package G;no strict;no warnings;\@ +A". "RGV=\@_=(\$_='$i');do{$g}||'zero';"or die$@;delete $::{'G::'};if(defi +ned $o){ok($o eq$n,sprintf("| %-4s -> %-6s == %-6s (length %3d) [%s]",$i,$ +o, $n,length $g,$g))}else{fail "Return value undefined ($g)"}}}

In reply to Re: The Perl Review by Koschei
in thread The Perl Review by Kit

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others wandering the Monastery: (10)
    As of 2014-10-26 04:37 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      For retirement, I am banking on:










      Results (151 votes), past polls