title: Perl - get first "word" from input string
body: <p>I am trying to write a Perl program that reads in lines from a text file, and, for each line, extract the first "word" from the line, and perform a different action based on the string that gets returned.</p>
  
  <p>The main loop looks like this:</p>
  
  <pre><code>while(&lt;AXM60FILE&gt;) {
  
     $inputline = $_;
  
     ($start) = ($inputline =~ /\A(.*?) /);
  
  perform something, based on the value of string in $start
  
  }
  </code></pre>
  
  <p>The input file is actually a parameter file, with the parameter_name and parameter_value, separated by a colon (":").  There can be spaces or tabs before or after the colon.</p>
  
  <p>So, the file looks (for example) like the following:</p>
  
  <blockquote>
    <p>param1: xxxxxxxxxxxx<BR>
    param2 :xxxxxxxxxxxxx<BR>
    param3 : xxxxxxxxxxxxxxxxx<BR>
    param4:xxxxxxxxxxxxx<BR></p>
  </blockquote>
  
  <p>That "($start) = ($inputline =~ /\A(.*?) /);" works ok for the "param2" example and the "param3" example where the 1st word is terminated by a blank/space, but how can I handle the "param1" and "param4" situations, where the parameter_name is followed immediately by the colon?</p>
  
  <p>Also, what about if the "whitespace" is a tab or tabs, instead of blank/space character?</p>
  
  <p>Thanks,
  Jim</p>