develooper Front page | perl.perl6.users | Postings from September 2017

overwrite?

Thread Next
From:
ToddAndMargo
Date:
September 23, 2017 06:35
Subject:
overwrite?
Message ID:
1fef4f06-f048-78a6-c77c-a9a5ef5e03d2@zoho.com
Hi All,

I want to overwrite a file.

Looking at:
https://docs.perl6.org/routine/open

I see ":truncate".  This seems liek it will do the trick.
Problem: I would like to read from the file first before
truncating (ro).

Is there a way to do this, or should I
    1) open the handle with :ro
    2) read what I want from it
    3) close the handle
    4) reopen the handle with :w and overwrite what I want?

Many thanks,
-T

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About