The following program:

my $skeleton = "bones\n";
my $new_file = "grave";
my $handle   = open($new_file, :w);

opens the "grave" file, but leaves it empty. A last line:

close($handle);    # "close()" generates an error message.

is required to get any contents in the file, unlike the equivalent Perl 5 code:

my $skeleton = "bones\n";
my $new_file = "grave";
open(my $handle, ">", $new_file) or die "$!";
print $handle $skeleton;

This might be a perfectly reasonable design decision, but I haven't
noticed it mentioned.

Reply via email to