in reply to Splitting into variables columned data without delimiters with a regexp ?
I need to do it using a regexp instead of unpack('A6 A5',$chunk_of_data) because the later is soooo slow...
The regex engine will not be quicker than unpack.
Your perceived problem with the performance of unpack is probably because you are calling it for each chunk rather than unpacking all the chunks in one go:
my @bits = unpack '(A6A5)*', $all_the_data;
This is much faster than unpacking each 11 byte chunk individually.
eg:
$data = 'AAAAAABBBBB' x 10;; @bits = unpack '(A6A5)*', $data;; print for @bits;; AAAAAA BBBBB AAAAAA BBBBB AAAAAA BBBBB AAAAAA BBBBB AAAAAA BBBBB AAAAAA BBBBB AAAAAA BBBBB AAAAAA BBBBB AAAAAA BBBBB AAAAAA BBBBB
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Splitting into variables columned data without delimiters with a regexp ?
by gerleu (Novice) on Nov 01, 2011 at 09:38 UTC | |
by BrowserUk (Patriarch) on Nov 01, 2011 at 09:46 UTC |