develooper Front page | perl.fwp | Postings from December 2001

The Twelve Days to Christmas

Thread Next
From:
Yanick
Date:
December 13, 2001 05:07
Subject:
The Twelve Days to Christmas
Message ID:
20011213081044.A8934@gilgamesh.sympatico.ca

	The following is not very clever obfuscation, and it's not the 
most palatable ASCII drawing ever drawn, but I suppose it's good enough 
to elicit a few chuckles and/or groans. 

Seasonaly yours,
`/anick

#!/usr/bin/perl
# to be run once a day from December 13 to December 24

$_=<<CHRISTMAS;

    Okay, so I blow at drawing bows...

                                  462757d6d65
        627370246275             7d6d696e67602            0796075627
       370207960796e6           7602c  6f6274637          0216d2c65616     
      0796e6   7602c6164696    563702  4616e63696      e67602d616964637
     0216d2d6  96c6b696e6760 2377716e  6370216d2    377796d  6d696e676 
    02765656375 60216d2c6169796e6760276f6c64 656e602279  6e6763702
     3616c6c696e67602269627463702642756e63686028656e6 370247572
      747c6560246f66756370214e646021602071627472796467656029
                     6e6021602075616270247275656e2
                            1111001001110110   
                   0000010000101110   0001011010100110   
                   0000010000100100   1111101000000100   
                   0010011010000110   1001111000000100   
                   0100011010100110   0110011011110110   
                   0100111010100110   0000010011000010   
                   0001011001001110   1001011011001110   
                   0010111010110110   1000011011001110   

                   0101000010011010   1111011010101110   
                   0100111000000100   0010111001001110   
                   1010111010100110   0000010000110110   
                   1111011001101110   1010011000000100   
                   1110011010000110   0110111010100110   
                   0000010000101110   1111011000000100   
                   0010111000010110   1010011010100110
CHRISTMAS

s/\s|\n//g;s/.*\.//;s/[10]*$//;($h,@gifts)=((pack"b*",$&),split' ',
(pack"h*",$_),24);@days=qw/one two three four five six seven eight 
nine ten eleven twelve/[0..($x=(localtime)[3]-13),11-$x];($_,$t)  =
(pop@days,'th');s|^o.*|last|||s|.*o$|second|||s|$t.*|${t}ird|||s
                 |$|$t|;s  |(?<!e)ve|f|;splice@gifts,0,22-2*$x;
         y.t..s;s|(n)e(t)|$1$2|;
print eval qq/"$h\n"/;$_="\u$_ @{[shift@gifts,shift@gifts]}\n"and
(s/One (A)(nd a)/$x?$1x$x.$2:$1/e+1)&&print for reverse@days;


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About