title: grep or map to find use statements in perl
body: <p>I am trying to write a perl module which takes another file as input and prints all the use statements(except strict and warnings)</p>
  
  <pre><code>my @result = grep /use\s+([^;(strict|warnings)]+)/, @file;
  </code></pre>
  
  <p>This prints :</p>
  
  <pre><code>use Package1;
  use Package2;
  </code></pre>
  
  <p>However I want only the "Package1" part. So when map is used:</p>
  
  <pre><code>my @result = map /use\s+([^;(strict|warnings)]+)/, @file;
  </code></pre>
  
  <p>this returns wrong values.(returns first 2 or 3 characters)</p>
  
  <pre><code>my @result = map /use\s+([^;]+)/, @file;
  </code></pre>
  
  <p>returns Package1,Package2,strict,warnings. </p>
  
  <p>May I know how to correct the regex in the first map statement?</p>
  
  <p>Thanks</p>