Using getc function to read character from a file : getc « File « Perl






Using getc function to read character from a file

   

open (FILEHANDLE, "<file.txt") or die ("Cannot open file.txt");

while (defined($char = getc FILEHANDLE)){
       print $char;
}

close FILEHANDLE;

   
    
    
  








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 with while loop
3.Using getc.