| Author | Post | |||
| CommComm         | Hi all. I try to read a binary file in perl with something like while(($var = getc(FILE01)) ne "" ) ... or while (!eof(FILE01)) { $c = getc(FILE01); ... But when i get a "1A" character (SUP) I' m stuck because the reading ends. A solution would be to read lines and split them, but perhaps somebody knows something easier or more tricky. TIA | |||
|  Edited by CommComm on 03.10.2004 12:34:04 | ||||
|  03.10.2004 10:28:46 | 
 | |||
| quangntenemy              | Hi, I think for a text file you should read line by line like this: 
open (FILE, "filename") || die "couldn't open the file!";
while ($line = <FILE>) {
  # do something with $line
}
close(FILE);
 | |||
|  03.10.2004 12:20:04 | 
 | |||
| CommComm         | Sorry.. I meant binary file..., reading byte by byte... | |||
|  03.10.2004 12:34:55 | 
 | |||