Chrkôkî‰éán™îk        ï wrote at Wed, 26 Mar 2003 12:34:15 -0300:

> I'm new in Perl, and I need to analyze a binary file, byte per byte.
> 
> $/ = undef;
> open FILE, "file.bin" or die $!;
> binmode FILE;
> my $data = <FILE>;
> 
> is that ok? how can I get one byte, the next, the next, etc?
> Thanks in advance!!

You can either set $/ to a reference to a number defining in what length
of chunks the files should be read:

$/ = \1;
while (my $char = <FILE>) {
  print $char, "\n";
}

or use the read function of Perl,
see
perldoc -f read
for details.


Best Wishes,
Janek

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to