zentara wrote:

#!/usr/bin/perl -w
use warnings;
use strict;
use Tk;

#generate the size of an my array.

my $filename = "julypromo.csv";
#Open the file
open FH, '<', $filename || die "Couldn't open $filename : $!";

Because of the precedence of the '||' operator your program will die if $filename contains either '0' or '' and not if open() fails. You need to either use parentheses:

open( FH, '<', $filename ) || die "Couldn't open $filename : $!";

Or use the lower precedence 'or' operator:

open FH, '<', $filename or die "Couldn't open $filename : $!";



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

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


Reply via email to