title: What is the clearest way to open a file and do "rescue" when it cannot be opened in Ruby
body: <p>I am now dealing with this issue by using the following code</p>
  
  <pre><code>begin
    File.open(filename, 'r')
  rescue
    print "failed to open #{filename}\n"
    exit
  end
  </code></pre>
  
  <p>Is there any way to do it more easily like Perl <code>'open (IN, $filename) || die "failed to open $filename\n"'</code> Thanks.</p>