#! /usr/bin/perl use strict; use warnings; use HTML::Parser; use LWP::Simple; my $keyword=$ARGV[0]; if(!@ARGV){ print "$0 ";exit;} my $tlink = "http://www.ponsline.de/cgi-bin/wb/w.pl?von=pons.de&Richtung=Englisch&Begriff=$keyword"; my $ergebniss = get($tlink); my $log='html.txt'; open FILE, ">$log" || die "$!\n"; print FILE $ergebniss; close FILE; my ($gget,$text); my $p = HTML::Parser->new(); $p->handler(start => \&start_handler,"tagname,attr,self"); $p->parse_file($log); unlink $log; sub start_handler{ return if(shift ne 'span'); my ($class) = shift->{class}; my $self = shift; if($class eq 'ZIEL'){ $self->handler(text => \&getst,"dtext"); } elsif($class eq 'GEN'){ $self->handler(text => sub{$text = shift;},"dtext"); } $self->handler(end => sub{print "$gget\n" if($class eq 'GEN')}); } sub getst{ my ($test) = @_; $gget = $test; }