Mega Code Archive

 
Categories / Perl / File
 

Using format_write function to save formatted data to a file

use IO::File; format TEXTFORMAT = @<<<<<<<<<<<@>>>>>>>>>>>>>>> $text1      $text2 . $text1 = "Hello"; $text2 = "there!"; $filehandle = new IO::File; $filehandle->open(">yourFile.txt") or die "Cannot open format.txt"; $filehandle->format_write (::TEXTFORMAT); $filehandle->close;