noob question"

I see advanced users here using various styles of open().
(wrapping done by -ed)
This:
  open( my $outfile, '>', 'perlfile.txt') or die("
                       Error opening file:$!");

And this:

  open my $outfile, '>', 'perlfile.txt' or die "could not open
   perlfile.txt for writing: $!\n";

Seem popular. 

Is there something beyond style that makes those methods better than
what appears to be a simpler format:

    open(my $outfile,">file.txt")or
         die "Can't open file.txt : $!";

    print $outfile "Hello world\n";


The last has several less elements of syntax to stumble over or forget
but that way of writing an `open()' seems to be out of favor.


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to