in reply to Re: Binary Reading Questions
in thread Binary Reading Questions
Quote:
| Why do you want to convert the stuff from the character to the integer at all? If there are no calculations to be made, you will likely be faster by not converting at all. But still, the IO overhead of reading the file will likely dwarf any optimizations you might make in your code ... |
Thanks for the information. I've never thought about this I/O overhead in that way. Makes me more comfortable about using the ord/chr functions a whole lot more.
As for your other question, this Perl script needs to handle binary files from anywhere of 2Mb to 16Mb (maximum). I need to utilize bitwise operators extensively, to seperate out bitfields suitable for use within Perl. Here's an example:
Also, thank you for pointing me into the direction of pfaut's Pack/Unpack Tutorial. I've already found it quite illuminating. Further study on my end is needed to see if the unpack function can efficiently carve up bitfields.$type = ord (substr ($entry, 0, 1)) & 191; # get filetype & remove file lock flag
I'll use binmode from now on.
Enjoy.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Binary Reading Questions
by idsfa (Vicar) on Jun 30, 2005 at 14:25 UTC | |
by Eyeth (Sexton) on Jun 30, 2005 at 15:57 UTC |