Greetings fellows, I have a rather short question about "the fastest way to..".
I have a string that kind of looks liks this:
$string = "123".\0.
And so on, 4 chars for each value nullpadded.
I have a procedure that fetches a value from the string based on a index but since I call that functions >60000 times I need the fastest way to get the value without the extra null-chars.
Up to now I've tried two alternatives:
(undef, $value) = unpack("a$index A4", $string);
$value = substr($string, $index, 4);
$value =~ s/\0//g;
But neither regexps nor unpack feels like the fastest way to do it. Is there any other way?