Using getc function with while loop : getc « File « Perl






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;

   
    
    
  








Related examples in the same category

1.The getc function gets a single character from the keyboard or from a file.
2.Using getc function to read character from a file
3.Using getc.