in reply to Re: Edit a New file in place after reading it in
in thread Edit a New file in place after reading it in

Yes, I was expecting Perl to create the file but it wasn't. I Googled for the answer for this but I couldn't make it work so I added that system "touch" to create it for me. I'd like to know why Perl was having a hard time creating the file on my Linux shell; it is still a mystery to me. Yes, I will use your suggestion to have the file time stamped. Grazie mille!

  • Comment on Re^2: Edit a New file in place after reading it in

Replies are listed 'Best First'.
Re^3: Edit a New file in place after reading it in
by Fletch (Bishop) on Dec 22, 2021 at 18:25 UTC

    Your code checks for errors from open (good) but it just calls die on failure (not so good). Better would be to include what you were trying to open as well as the contents of the $! variable which will tell you what the problem was (showing just creating your output handle but similar message are useful for opening files for input as well):

    open my $outfh, '>', $New_part_report or die "Problem opening '$New_part_report' for writing: $!\n";

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.