fixed rust i/o ; use sys{read,write} in perl impl