Re: parsing a line

[email protected] (Wiggins d'Anconia) Tue, 19 Aug 2008 12:45:22 -0400
Newsgroups perl.beginners.cgi
Organization http://danconia.org
Message-ID <[email protected]>
thunder wrote:
> Hello all
> 
> I have the following small file that i am parsing one line at a time
> (each line consists of hex values)
> 
> line 1: 0d
> line 2: 00000000
> line 3: 00002000
> line 4: 0064
> line 5: 76d457ed462df78c7cfde9f9e33724c6
> line 6: bded7a7b9f6d763e
> line 7: 0059010081bb300597603b6f90ef4421
> line 8: 001608427754e957a0d281bb30059760
> line 9: a72f731c3be600000000000000000000
> 
> 
> For line 5, for example, i want to break it up into chunks of 8 hex
> charaters (ie for example 76d457ed, 462df78c etc).
> I tried to use the shift operator (ie << or >>) but perl gives an
> error.
> 
> Any help with the above would be appreciated.
> 
> Thanks
> 
> 
> 

Check out the pack/unpack functions,

perldoc -f unpack

http://danconia.org