Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Welcome to the Monastery

Red Perl part I

by ysth (Canon)
on Apr 30, 2004 at 19:59 UTC ( #349497=obfuscated: print w/ replies, xml ) Need Help??

$t=[[[e=>[[[[w=>[L=>"R"]],[[T=>[G=>"I"]],[[V=>[",","."]],[[H=>"J"],[K= +>"Y"]]]]] ,[h=>"P"]],"s"]],[[[[[p=>"v"],"\n"],"l"],"t"],[[[S=>[B=>"M"]],[[b=>"f" +],[m=>[F =>"O"]]]],"o"]]],[[[[n=>"d"],[[[[W=>[[q=>"x"],"Q"]],"g"],[C=>"k"]],[[u +=>[D=>"U" ]],"N"]]],[[a=>"i"],[[c=>[y=>[A=>[[z=>"'"],"E"]]]],"r"]]]," "]];sub d{ +($r,$o)=$ _;$z=ord(chop($r))-34;$r=~s/(.)(.)/sprintf"%013b",58-($2 ge']')+92*(or +d($1)-($1 ge']')-35)+ord($2)/eg;substr(($r=reverse$r),13-$z,$z,'');while(length$ +r){$c=$t; $c=$c->[chop$r]while+ref$c;$o.=$c}$o};for(<DATA>){s/\s//g;print d};__D +ATA__ .W&fKq+7Lv.}/~y_W+v99r{PspGYxc:WFH_sNH"4glv(rpJa92qx`|d|Fxth/[[x;#Ne1H +.H8TwjQEygBIEm(Sw]]6W"te-*X}kcy+sQ'i)@9b?eP%Y]8xjM6kOvhsex=mo~%,KW$ji +()IAC,}gmLB-=zKD_ny(,Y"It)qhCWY{uXuL@CeoqygBIyvg6PVv0(<{j#F4gv0'T:,lD +ViTNuN0puzyvg6PU"LmL;fi]s@)'sQ'i*@g]Qsx]JR[821xdq.[AAc&]3[+0/Jm'd?p:. +W{O>h5$hYCALsmV6W)&wEgAnXW?kQnDBtG[EH:giJ8EZJfQ=w-,KW$]MkjgB]T)Hl^Ecb +oLUSyqDF{vdNn9:5'TgJN^u+<E%V``@`|%|%|%|%|%|%|%|%|%|%{k+NO|)$v+b~wQ{t| +$|%lf{8|$|%qY{M|$NQu^:Sm-0l[HNQ|%|%|%|%|%|%|%|%|%|%01G~:5KpNHt~H+<+BG +V9dSCktf0oz$Ux^I9ymH0F12a2y+^sXfriY>#UrRvuRxLP^n|%|%|%|%|%|%|%|%|%|%o +GtpJM)jm>,}oc*>n`JA`aZO7H>`-nHrQU7QBUKpF1.ha%mGU-rVtr%5E+l{QdfCM$lr@J +zv9IVO0A{9Z$xiUz%5WW$tJBCEHl^Ee2gC/6G%yZ#]X%Dl^2Rn#H]$s<%(0+i2uZsQ'fx +V`dBc{o93"c)<f$1jg1G_>q/vDl_zKwFKYoP18?kAk*n;OyV3zt:$<EmfO=TdNmmF'JP) +GwDkcboFhb)tqSp:.W:Jt'+SHl^Ecbyc^3>@l"Rb.W&c[Ahl2QGH)'=F0y`9ycd37~KwT +AwMf;AT]a0E#nmML<zBv3{Jt'*/c^gAs;R`NhG7.rrpJ_b`HhN9Kxk*Pq<me$/'J`X2<1 +a<xX]l+9,}gmK3q?YDj)u+<E%nbxR0`Y.'P0NOUIi0tCT3=""3*

-- with thanks to D. Huffman

update: eol issues fixed

Comment on Red Perl part I
Download Code
Re: Red Perl part I
by simonm (Vicar) on Apr 30, 2004 at 20:30 UTC
    This fails for me, with "substr outside of string at /tmp/t line 11, <DATA> line 1." (This is perl, v5.6.0 built for darwin.)
      That will result if you save it with incorrect line endings for your platform.
Re: Red Perl part I
by mpolo (Chaplain) on May 01, 2004 at 13:41 UTC

    Well, it doesn't "fail" per se for me, but I think that I am too thick to understand the output:

    The hmneede

    Using Fedora Core 1, perl 5.8.3. I just hit "download code" and ran it...

      That's strange; if you run it with warnings on, what do you see?

      What does this say?

      print join ":", map ord, split //, <DATA>;__DATA__ .W&fKq
        Here's the output under perl -w
        Argument "*" isn't numeric in array element at line 7, <DATA> + line 1. Argument "" isn't numeric in array element at line 7, <DATA> +line 1. Argument "" isn't numeric in array element at line 7, <DATA> +line 1. The hmneede
        The other code fragment prints 46:87:38:102:75:113:13:10

      That's exactly what it prints for me when I don't remove the control-m's. When removing them, the output seems ok. I'm on i686-linux, perl 5.8.1.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: obfuscated [id://349497]
Approved by sschneid
Front-paged by broquaint
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (10)
As of 2014-04-20 14:17 GMT
Find Nodes?
    Voting Booth?

    April first is:

    Results (485 votes), past polls