<?xml version="1.0" encoding="windows-1252"?>
<node id="469724" title="&quot;or die&quot; versus &quot;|| die&quot;" created="2005-06-24 10:48:12" updated="2005-08-14 23:34:52">
<type id="115">
perlquestion</type>
<author id="386673">
ghenry</author>
<data>
<field name="doctext">
&lt;p&gt;&lt;b&gt;Update:&lt;/b&gt; I asked this in the CB, but wanted to keep a record of it here for other inexperienced Monks like myself.&lt;/p&gt;
&lt;p&gt;In [id://469561] yesterday, I did the classic &lt;c&gt;or die&lt;/c&gt; whilst opening a file, as per most code I've ever seen.&lt;/p&gt;However, in the [http://perldoc.perl.org/index-faq.html|perlfaq], [http://perldoc.perl.org/perlfaq5.html#How-can-I-read-in-an-entire-file-all-at-once%3f|How can I read in an entire file all at once?] I see a lot of &lt;c&gt;|| die&lt;/c&gt;&lt;/p&gt;
&lt;p&gt;In [id://469561], I use:&lt;/p&gt;&lt;p&gt;&lt;c&gt;open( RPMS, "&lt;", "./upgrade.log" ) or die "can't open file: $!\n";&lt;/c&gt;&lt;/p&gt;&lt;p&gt;but in [http://perldoc.perl.org/perlopentut.html#Simple-Opens|perlopentut - Simple Opens] it shows&lt;/p&gt;&lt;p&gt;&lt;c&gt;open( INFO, "&gt;", $datafile ) || die "Can't create $datafile: $!";&lt;/c&gt;&lt;/p&gt;
&lt;p&gt;Which way is the best and why?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;br/&gt;Gavin.&lt;/p&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-386673"&gt;
&lt;small&gt;Walking the road to enlightenment... I found a penguin and a camel on the way.....&lt;br/&gt;
Fancy a yourname@perl.me.uk? Just ask!!!&lt;/small&gt;
&lt;/div&gt;&lt;/div&gt;</field>
</data>
</node>
