title: Concise foreach expression in one line
body: <p>In Perl, one can often avoid using control blocks, like this:</p>
  
  <pre><code>print "$_\n" foreach(@files);
  </code></pre>
  
  <p>instead of:</p>
  
  <pre><code>foreach(@files){
    print "$_\n";
  }
  </code></pre>
  
  <p>How does this syntax work in the following, more complex case:</p>
  
  <pre><code>die("Not a file: $_") unless -f $_ foreach(@files);
  </code></pre>
  
  <p>It gives me a syntax error. I'm not trying to write obfuscated code, it's just an unimportant part in the program, and so I want to express it as concisely as possible.</p>
  
  <p><strong>SUMMARIZED ANSWERS:</strong> </p>
  
  <p>I can accept only one answer as the accepted answer, but I like the following ones from Chris and Jon best.</p>
  
  <p>This one uses <code>foreach</code> as I intended, but without the <code>syntax error</code>:</p>
  
  <pre><code>-f or die "Not a file: $_" foreach @files;
  </code></pre>
  
  <p>And the following one is at least as good. I like that <code>die</code> is at the beginning of the statement because that's what the reader's attention should be directed toward:</p>
  
  <pre><code>die("Not a file: $_") for grep {!-f} @files;
  </code></pre>