perl hokusai implementation