Jonathan Lee wrote:
> 
> Hi all,

Hello,

> Can someone please help...
> 
> I am trying to write a script to do the following -
> 
> 1/ Open up a binary file to read.
> 
> 2/ Read the file byte by byte.

Why do you think that you need to read the file a byte at a time?

> 3/ Convert the bytes read from binary to Hex.

perldoc -f ord
perldoc -f sprintf
perldoc -f pack

> I think the "binmode" and "pack" function should be used but can't get it
> right... or maybe I'm completely off the planet!
> 
> binmode FILEHANDLE;
> read (FILEHANDLE, $var, 1);
> $out = pack("B8", $var);

It is not clear exactly what you want to do.  Could you give an example
of what you want the output to look like?


John
-- 
use Perl;
program
fulfillment

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

Reply via email to