... char * str; sv_setiv(integer, SvIV(integer)); // <--- here str = SvPV_nolen(integer); ...