I normally use WWW::Mechanize for that sort of thing.
In reply to Re: Need to test HTTP page responses by jonadab in thread Need to test HTTP page responses by cantfindausername