#!/usr/local/bin/perl require WWW::Mechanize; use strict; use warnings; { my $mech = WWW::Mechanize->new(); my $Input = ("LastName, FirstName"); &Search; sub Search { #print "Enter Search String:"; #goes to main search page. $mech->get('mywebsite.com/search.asp'); print "Webpage navigation start success result: "; &Get_Success; #submits the search form on the webpage just entered. $mech->submit_form( form_number => 1, fields => { query => $Input, } ); print "Form submission success result: "; &Get_Success; #finds all the links with "Server-" found inside the title. my @temp1 = $mech->find_all_links( text_regex => qr/Server-/i ); print "Link retrieval success result: "; &Get_Success; foreach (@temp1) { print $_->url(), "\n"; print $_->text(), "\n"; print $_->name(), "\n"; print $_->tag(), "\n"; } sub Get_Success { #prints the success result and starts a new line. print $mech->success(); print "\n"; } }