I put strict off and it gives no errors,
It is recommended to put it back on and declare variables properly.
then i ran it and it gave line 6 unknown agent 'firefox'
This is because there is no agent alias called "Firefox". Use known_agent_aliases() to get available names, for example:
$ perl -MWWW::Mechanize -E'say join ", ",WWW::Mechanize::known_agent_a
Linux Konqueror, Linux Mozilla, Mac Mozilla, Mac Safari, Windows IE 6,
+ Windows Mozilla
and line 1900 of mechanize.pm says there is no form numbered 2
Try using Data::Dumper and forms() method to get the list of forms available for WWW::Mechanize.
Sorry if my advice was wrong.