use strict; use warnings; use diagnostics; open (DOG, ">not.txt") or die ("Cannot open not.txt"); print DOG "hello!"; open (DOG, "){ print;} close (DOG);