title: Automatic Search Using WWW::Mechanize
body: <p>I am trying to write a Perl script which will automatically key in search variables on <a href="http://www.lexisnexis.com/hottopics/lnacademic/?verb=sr&amp;csi=379740" rel="nofollow">this LexisNexis search page</a> and retrieve the search results.</p>
  
  <p>I am using the <a href="http://www.google.nl/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=1&amp;cad=rja&amp;uact=8&amp;ved=0CCMQFjAA&amp;url=http%3A%2F%2Fsearch.cpan.org%2Fperldoc%3FWWW%3A%3AMechanize&amp;ei=PcPGVJfxGMW8PZGRgLgM&amp;usg=AFQjCNGOLOItw538wJF1RjwjrCft2iBVfg&amp;sig2=py0LvHwvC_chnwfrrgP24g" rel="nofollow">WWW::Mechanize</a> module but I am not sure how to figure out the field name of the search bar itself. This is the script I have so far -></p>
  
  <pre><code>#!/usr/bin/perl
  use strict;
  use warnings;
  use WWW::Mechanize;
  my $m = WWW::Mechanize-&gt;new();
  
  my $url = "http://www.lexisnexis.com/hottopics/lnacademic/?verb=sr&amp;csi=379740";
  $m-&gt;get($url);
  
  $m-&gt;form_name('f');
  $m-&gt;field('q', 'Test');
  my $response = $m-&gt;submit();
  print $response-&gt;content();
  </code></pre>
  
  <p>However, I think the "Name" of the search box in this website is not "q". I am getting the following Error - "Can't call method "value" on an undefined value at site/lib/WWW/Mechanize.pm line 1442." Any help is much appreciated. Thank you !</p>