Perl Monk, Perl Meditation | |
PerlMonks |
Way to grep binary scalar without unpackingby Eradicatore (Monk) |
on Oct 04, 2007 at 18:28 UTC ( [id://642724]=perlquestion: print w/replies, xml ) | Need Help?? |
Eradicatore has asked for the wisdom of the Perl Monks concerning the following question:
Does someone know if you can use regex to grep through a scalar value you just read out from a file in binmode?
I want to read out say 1000 bytes of a file, and then scan that 100 bytes for a string. But I do NOT want to first unpack it because I'm hoping that avoiding the unpack may save some time. Or am I fooling myself into thinking that dealing with the scalar in binary form will be any faster than unpacking and then using normal regex? If I do unpack, what's the best way to do that?
Justin Eltoft "If at all god's gaze upon us falls, its with a mischievous grin, look at him" -- Dave Matthews
Back to
Seekers of Perl Wisdom
|
|