Mega Code Archive

 
Categories / Perl / File
 

Using getc function with while loop

use IO::File; $filehandle = new IO::File; $filehandle->open("<file.txt") or die "Could not open file.txt"; while (defined($char = $filehandle->getc)) {     print $char; } $filehandle->close;