Category: Fun Stuff
Author/Contact Info Octavian
Description: I was bored sitting around the office, and I felt like annoying a co-worker so I decided to write something up real quick that will email him messages in morse code. This code basically just converts whatever you give it as arguments into more code and emails it to the first argument. so you could do a ./convert this is a test of morse code. and it would send someperson the sentence in morse code
$who = $ARGV[0];
$who =~ s/\s+$//;

open(tomail,"|/usr/sbin/sendmail $who");
foreach $line(@ARGV)
  $line =~ s/\s+$//;
  $line =~ s/\s+/\^ /g;
  $line =~ tr/[A-Z]/[a-z]/;
  $line =~ s/\./\.\-\.\-\.\- /g;
  $line =~ s/\?/\.\.\-\-\.\. /g;
  $line =~ s/\!/\.\-\-\-\-\. /g;
  $line =~ s/a/\.\- /g;
  $line =~ s/b/\-\.\.\. /g;
  $line =~ s/c/\-\.\-\. /g;
  $line =~ s/d/\-\.\. /g;
  $line =~ s/e/\. /g;
  $line =~ s/f/\.\.\-\. /g;
  $line =~ s/g/\-\-\. /g;
  $line =~ s/h/\.\.\.\. /g;
  $line =~ s/i/\.\. /g;
  $line =~ s/j/\.\-\-\- /g;
  $line =~ s/k/\-\.\- /g;
  $line =~ s/l/\.\-\.\. /g;
  $line =~ s/m/\-\- /g;
  $line =~ s/n/\-\. /g;
  $line =~ s/o/\-\-\- /g;
  $line =~ s/p/\.\-\-\. /g;
  $line =~ s/q/\-\-\.\- /g;
  $line =~ s/r/\.\-\. /g;
  $line =~ s/s/\.\.\. /g;
  $line =~ s/t/\- /g;
  $line =~ s/u/\.\.\- /g;
  $line =~ s/v/\.\.\.\- /g;
  $line =~ s/w/\.\-\- /g;
  $line =~ s/x/\-\.\.\- /g;
  $line =~ s/y/\-\.\-\- /g;
  $line =~ s/z/\-\-\.\. /g;
  $line =~ s/0/\-\-\-\-\- /g;
  $line =~ s/1/\.\-\-\-\- /g;
  $line =~ s/2/\.\.\-\-\- /g;
  $line =~ s/3/\.\.\.\-\- /g;
  $line =~ s/4/\.\.\.\.\- /g;
  $line =~ s/5/\.\.\.\.\. /g;
  $line =~ s/6/\-\.\.\.\. /g;
  $line =~ s/7/\-\-\.\.\. /g;
  $line =~ s/8/\-\-\-\.\. /g;
  $line =~ s/9/\-\-\-\-\. /g;
  $line =~ s/\,/\-\-\.\.\-\- /g;
  print tomail "$line ";
print tomail "\n";
close tomail;