title: split and assign in one statement in Perl
body: <pre><code>@temp = split(/\./, $_);
  $val = $temp[1];
  $val =~ s/\D//;
  </code></pre>
  <p>What is the correct syntax to write a single statement instead of these three statements in Perl?</p>
  <pre><code>($val = split(/\./, $_)[1]) =~ s/\D//;
  </code></pre>
  <p>gives me</p>
  <blockquote>
  <p>syntax error at test.pl line 126, near &quot;)[&quot;</p>
  <p>Execution of test.pl aborted due to compilation errors.</p>
  </blockquote>