On Wed, Sep 15, 2010 at 08:42:48AM +0200, Gabor Szabo wrote:
> Can I rely in Perl 6 that a file is flushed and closed correctly when
> Perl shuts down?

I don't know the answer to this question, but I suspect "yes".

> The probably more interesting case is this:
> 
> #!/usr/bin/perl6
> use v6;
> 
> my $filename = "temp.txt";
> 
> {
>     my $fh = open $filename, :w;
>     $fh.say("hello world");
> }
> ...
> Can I be sure that the file is already flushed and closed when $fh
> goes out of scope
> or do I need to explicitly call $fh.close in the first block?

You need to explicitly call $fh.close.

Pm

Reply via email to