Mega Code Archive

 
Categories / Perl / File
 

Using read function to read a file

open (FILEHANDLE, "<file.txt") or die "Cannot open file.txt"; $text = ""; while (read (FILEHANDLE, $newtext, 1)){     $text .= $newtext; } print $text;