title: Match regex and assign results in single line of code
body: <p>I want to be able to do a regex match on a variable and assign the results to the variable itself. What is the best way to do it?</p>
  
  <p>I want to essentially combine lines 2 and 3 in a single line of code:</p>
  
  <pre><code>$variable = "some string";
  $variable =~ /(find something).*/;
  $variable = $1;
  </code></pre>
  
  <p>Is there a shorter/simpler way to do this? Am I missing something?</p>