Hi, open(FILEHANDLE, filename); binmode(FILEHANDLE);
above two statements will work if you want to read a binary file. There is not need of using read function here. Regards, Ganesh "John W. Krahn" <[EMAIL PROTECTED]> wrote: >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] > > __________________________________________________________________ The NEW Netscape 7.0 browser is now available. Upgrade now! http://channels.netscape.com/ns/browsers/download.jsp Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]