The following is code that can be run to take a long url in as input on the command line and it will spit out a short url. usefull when you need to give someone a long link over the telephone or when long urls look ugly
Code:
#!/bin/perl
use WWW::Mechanize;
use URI::Escape;
my $mech = WWW::Mechanize->new();
my $encoded = uri_escape(@ARGV);
$mech->get("http://www.tinyurl.com");
$mech->field("url", $encoded);
$mech->submit();
my $page = $mech->content();
my ($result) = $page =~ /<small>\[<a href="(.*?)"/;
print "$result\n";