|P is for Practical|
"or die" versus "|| die"by ghenry (Vicar)
|on Jun 24, 2005 at 14:48 UTC||Need Help??|
ghenry has asked for the wisdom of the Perl Monks concerning the following question:
Update: I asked this in the CB, but wanted to keep a record of it here for other inexperienced Monks like myself.
In Downloading a lot of files yesterday, I did the classic or die whilst opening a file, as per most code I've ever seen.However, in the perlfaq, How can I read in an entire file all at once? I see a lot of || die
In Downloading a lot of files, I use:
open( RPMS, "<", "./upgrade.log" ) or die "can't open file: $!\n";
but in perlopentut - Simple Opens it shows
open( INFO, ">", $datafile ) || die "Can't create $datafile: $!";
Which way is the best and why?
Walking the road to enlightenment... I found a penguin and a camel on the way.....
Fancy a firstname.lastname@example.org? Just ask!!!