http://www.perlmonks.org?node_id=469724

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?

Thanks,
Gavin.

Walking the road to enlightenment... I found a penguin and a camel on the way.....
Fancy a yourname@perl.me.uk? Just ask!!!