Print message in case of file open failure : File Output « File « Perl






Print message in case of file open failure

    

open (FILEHANDLE, ">hello.txt") or die "Cannot open hello.txt";
print FILEHANDLE "Hello!";

close (FILEHANDLE);

   
    
    
    
  








Related examples in the same category

1.Print out file line number
2.Print text to file
3.Prints the size of a file in bytes.
4.Numbering Lines in Multiple Files
5.Output file line by line
6.Output file