wrote in
news: ups.com:
> I'm using Active state 5.8 and writing for windows. I have a very
> simple parser that writes a csv file (Comma separated Values). It
> looks like this:
>
> eval{
> open APOUT, ">APresults.csv" || die "Can't open file
> APresults.csv!";
You should include the reason why the file could not be opened in the
error message. Also, you have used || in the call above. It will never
die.
open my $apout, '>', 'APresults.csv'
or die "Can't open 'APresults.csv': $!";
If you want to use ||, then you should properly paranthesize the open
call:
open(my $apout, '>', 'APresults.csv')
|| die "Can't open 'APresults.csv': $!";
....
> if ($@){
> print $@;
> }
IMNSHO, it is better to write error messages to stderr. In fact, given
your script, I would just use:
die $@ if $@;
....
Sinan
--
A. Sinan Unur <>
(reverse each component and remove .invalid for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/cl...uidelines.html