#! perl -slw use strict; use Inline C => << '__C__', NAME => 'test', CLEAN_AFTER_BUILD => 0; #include SV* test( SV *a, SV *b ) { SV * n = newSVsv( a ); if( !SvPOK( n ) && ( SvNOK( n ) || SvIOK( n ) || SvUOK( n ) ) ) // numeric SvPV_nolen( n ); // Force a string rep if( !SvPOK( n ) ) // Still nothing, must be undef? sv_setpv( n, "" ); // Make it the null string to stop (one possible) // Use of uninitialized value in subroutine entry from sv_catsv if(SvPOK( b ) || ( !SvPOK( b ) && ( SvNOK( b ) || SvIOK( b ) || SvUOK( b ) ) ) ){ sv_catsv( n, b ); } return n; } __C__ print test( 'bill', 'fred' ); my( $p, $q ) = ( 'fred' ); print test( $q, $p ); $q = 'bill'; print test( $q, $p ); $q = 1; print test( $q, $p ); $p = 1; print test( $q, $p ); __OUTPUT__ billfred fred billfred 1fred 11