#!/usr/bin/perl
use warnings;
use strict;
################################
# By: Ventz Petkov             #
# Date: 11-16-05               #
# Jokes 2 Go - Joke of the Day #
################################
use WWW::Mechanize;
use HTML::Strip;

my $mech = WWW::Mechanize->new();
my $hs = HTML::Strip->new();
my $name = $ARGV[0];
my $url = "http://www.jokes2go.com/cgi-bin/includejoke.cgi";
$mech->agent_alias( 'Mac Safari' );
$mech->get( $url );
my $page = $mech->content;
$page =~ s/document.write\('(.*)\\n'\);/$1/;
my $clean_text = $hs->parse( $1 ); $hs->eof;
$clean_text =~ s/\\'/'/sg; $clean_text =~ s/  / /sg;
print "$clean_text\n";
