> -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Friday, June 22, 2007 12:04 PM > To: beginners@perl.org > Subject: How can I compare Bytes in a Binary File? > > Hi guys/gals, I'm having a bit of a problem and wondering if anyone > can help. > > I've got a binary file here that I'm reading byte by byte and I'm > trying to compare the raw binary data... but I'm running into problems > with bytes without an ASCII representation. For example, if I'm > looking for hex value 58 its fine, because I can just read a byte and > see if ($byte eq "X") since 58 is X in ASCII. What if I want to search > for ff or c6 or something which has no ASCII representation? > > Thanks! >
The function you need is 'ord $byte'. Bob McConnell -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/