in reply to Comparing the bytes of a file

Once you have read your string, you could then use @bytesFromFile = unpack'C*',$string; to allow you to compare them byte by byte.

Alternatively, you could $stringFromBytes = pack'C*', @myValues; and the use any of perl's usual string comparison methods.

Without seeing your code that's failing, or a better description of your application, it's hard to see how to help you further.


What's this about a "crooked mitre"? I'm good at woodwork!

Replies are listed 'Best First'.
Re: Re: Comparing the bytes of a file
by Monolith-0 (Beadle) on Aug 28, 2002 at 18:12 UTC

    Ah, pack looks like what I need to use. That should allow me to get the string that I want with all the odd bytes in it. If that doesn't work, I can still try it the other way around using unpack. Thanks for your help!

    - Monolith