Charles K. Clarkson recently replied to Sreedhar Reddy in which one of the corrections he made was:

open my $fh, '<', $input_file or die qq(Cannot open "$input_file": $!);

It seems that Charles' habits are to prevent excess typing and to 'be lean on variables' as he phrased it I believe.

When I have opened a file, I have always done:

open (FILE, $file) || die "Cannot open $file :$!";

A couple of things different.
- I use a FILEHANDLE, where Charles used a variable.
- Charles explicitly said the file was being opened for reading. My understanding is that is the default. I assume that Charles did this for clarity. - Charles opted to use qq() which cause him to have to enclose the $input_file in "".


My question is, which way is better, and why is it better? My assumption is Charles' method is better, but I would appreciate knowing why.

Thanks,
Mike

--

 rm -fr /bin/laden
  00:40:01 up  9:03,  3 users,  load average: 0.00, 0.06, 0.07

 Linux Registered User #241685  http://counter.li.org

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to