I was running the following buggy code:
sub save {
my $fh = open('data.txt', :w);
LEAVE: $fh.close;
$fh.print("hello\n");
}
save();
(note the : after the LEAVE)
Which if I am not mistaken is basically the same as:
sub save {
my $fh = open('data.txt', :w);
$fh.close;
$fh.print("hello\n");
}
save();
and I kept getting the error in the subject which greatly confused me.
Shouldn't this be something like a "print of closed filehandle" error?
Gabor
