use overload ( # this is the cryptic name of the "stringification" operator '""' => op_stringify, ); # and then in the XS code: char * op_stringify(left, right, swap) SV * left SV * right bool swap CODE: RETVAL = my_stringify(left); OUTPUT: RETVAL