Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

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'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

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2023-10-03 17:35 GMT
Find Nodes?
    Voting Booth?

    No recent polls found