sophie: A cartoon-like representation of a girl standing on a hill, with brown hair, blue eyes, a flowery top, and blue skirt. ☀ (Default)
[personal profile] sophie
This comm needs more posts. :D

Has anyone here made a JAPH? I made one way back in 2002 and it isn't really that great (hey, it was 6-7 years ago, give me some slack :D), but I thought I'd share it anyway:

#!/usr/bin/perl

    $smilies="jolly-               fun-resilient-
   mirthful--adorable-            enticing-sloping
   -ecstatic-happy-              delightful-enrapt-
     -rhapsodic-                  earless-grinning

                  -!melancholy-
                    -mighty-
                   appropriate-
                    accepted


-joking-cheerful                    -!rare";$smilies=~
   s/[\n \!]//g;                  $smilies=~s/--/-=/g;
    @joyful=split(               '-',$smilies);my
      $smile=":-D";             my $elation=-1;
        while($smile ne "rare"){$elation+=1;
         $smile=$joyful[$elation];if($smile
           =~/^=^?/){($smile)=$smile=~
           /.(.*)/;print" ";}@pleasing=
              split('',$smile);print
                $pleasing[($elation
                      %4)];}


There are a few Easter eggs in the source. :)
marnanel: (Default)
[personal profile] marnanel
When you have data in a string, Perl remembers the encoding the string's in. If you grab UTF-8 stuff out of a database or from HTTP parameters, it doesn't know what the encoding is, and it will get it wrong. This function returns the strings you passed it concatenated and marked as UTF-8:

sub mark_utf8 { pack "U0C*", unpack "C*", join('',@_); }

Profile

perl: cc-by-nc (Default)
Pathologically Eclectic Rubbish Lister

August 2012

S M T W T F S
   1234
56 7891011
12131415161718
19202122232425
262728293031 

Syndicate

RSS Atom

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 29th, 2017 12:27 am
Powered by Dreamwidth Studios