$value = substr($string, $index, 4); $value =~ y/\0//d;