in reply to Accessing individual bytes of a binary file as numerical values

Perhaps ord and chr? Or maybe not turn the unpack'd value right back into a character?

$ perl -lE 'say join( q{,}, unpack( "C*", qq{Hello} ) )' 72,101,108,108,111 $ perl -lE 'say join( q{,}, map ord, split(q{},qq{Hello}) )' 72,101,108,108,111 $ perl -lE 'say pack( "C*", 72, 101, 108, 108, 111 )' Hello

The cake is a lie.
The cake is a lie.
The cake is a lie.

  • Comment on Re: Accessing individual bytes of a binary file as numerical values
  • Download Code