Re: [PBML] create a file
- I've always thought using 'die' was a bit drastic.
I prefer to:
if ( ! open( MYFILE, "$myfile ) )
print "Error message";
# die ONLY if the program cannot go on
# Continue program.
If you are processing multiple files you may be able to print an
error message and continue, skipping the problem file.
--- In perl-beginner@y..., jonathansamuel@y... wrote:
> --- In perl-beginner@y..., "Kai Hintze" <kai_hintze@e...> wrote:
> > open(FILE, ">$myfile");
> It is usually a good idea to use the "or die $!" syntax in order to
> receive a warning when the file cannot be opened. Thus:
> # Tested on ActiveState 5.6.1/NT4
> use strict;
> my $myfile = ">test.txt";
> open(MYFILE, $myfile) || die $!;