open (FILEHANDLE, "<file.txt") or die ("Cannot open file.txt"); while (defined($char = getc FILEHANDLE)){ print $char; } close FILEHANDLE;