use LWP; use HTML::Parser; $url = 'xx'; $ua = LWP::UserAgent->new(); $form = $ua->get($url) or die "Couldn't fetch $url"; $form->is_success() or die $form->message(); print $form->content(); my $session = ""; my $parser = HTML::Parser->new; $parser->handler(start => \&start_handler,"tagname,attr,self"); $parser->parse( $form->content ); print $session; sub start_handler{ my ($tag,$attr,$self) = @_; return unless $tag eq 'form'; my $action = $attr->{action}; ($session) = $action =~ /jsessionid=(.*)/; }