You did only do the unpack to an array once--not every time you needed a number--didn't you?
If that is the case, I'd benchmark combining substr and unpack against the other options:
my $str = ...;
sub fetchOne{ unpack 'a4', substr $str, $_[ 0 ] * 4, 4 }
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
|