$value = unpack "x$index Z4", $string; [download]
$value = substr($string, $index, 4); $value =~ y/\0//d; [download]
In reply to Re: Null-stripping performance by Thelonius in thread Null-stripping performance by qiau