http://www.perlmonks.org?node_id=189382
Category: Fun Stuff
Author/Contact Info jtarchie <thealienz123@yahoo.com> AIM: thealienz123 ICQ: 5673454
Description:

English:
--------
I was crawling the internet one day looking for translators for SMS text messaging. You so, I could be kewl, and confuse my friends with a language even I didn't understand. And so I found transl8it.com. It offers translation for english<->SMS lingo.

Lingo:
--------
I wz crawling d internet 1 dA L%kN 4 transl8rz 4 SMS txt msgN. U so, I c%d b kewl, & Confuz my fRnds w a language even I didn't undRstNd. & so I found transl8it.com. it offers transl8n 4 english<->SMS lingo.

use strict;
use LWP::UserAgent;
use HTTP::Request::Common;
use HTML::Form;

my $agent = new LWP::UserAgent;
my $url = 'http://www.transl8it.com/index.cgi?convert';
if($ARGV[0] eq '-to') {
    #Translates from english to text lingo
    print "English to lingo - \n";
    print "Type Message: ";
    my $input = <STDIN>;
    chomp($input);

    #Actual FORM post data
    my %data = (    'txtMessage' => $input,
            'direction' => '<--'
        );
    my $request = $agent->request(POST $url, [%data]);
    my $content = $request->content();
    my @forms = HTML::Form->parse($content, $url);
    foreach my $form (@forms) {
        eval{
            if(defined($form->value('txtTranslation'))) {
                print "\nTranslation: \n" . $form->value('txtTranslati
+on');
                last;
            }
        };
        if(@_) {next;}
    }
} elsif($ARGV[0] eq '-from') {
    #Translates from text lingo to english
    print "lingo to English - \n";
    print "Type Message: ";
    my $input = <STDIN>;
    chomp($input);

    #Actual FORM post data
    my %data = (    'txtMessage' => $input,
            'direction' => '-->'
        );
    my $request = $agent->request(POST $url, [%data]);
    my $content = $request->content();
    my @forms = HTML::Form->parse($content, $url);
    foreach my $form (@forms) {
        eval{
            if(defined($form->value('txtTranslation'))) {
                print "\nTranslation: \n" . $form->value('txtTranslati
+on');
                last;
            }
        };
        if(@_) {next;}
    }
} else{
    print 'perl trans.pl (-to|-from)';
}