use strict; use warnings; use Devel::Peek; my $dd = "hello world\n"; Dump $dd; my $ee = cc($dd); printf("the dd string address is %x \n", cc($dd)); dd($ee); use Inline Config => BUILD_NOISY => 1, CLEAN_AFTER_BUILD => 0; use Inline 'C' => <<'CODE'; int dd(UV x){ printf("string is %s \n", (char*)x); return 0; } UV cc(SV* a){ return SvPVX(a); } CODE ###############output########### andy@andyhome:~/one-off$ perl abe.pl SV = PV(0x56386170b050) at 0x56386172f008 REFCNT = 1 FLAGS = (POK,IsCOW,pPOK) PV = 0x5638617addf0 "hello world\n"\0 CUR = 12 LEN = 14 COW_REFCNT = 1 the dd string address is 5638617addf0 string is hello world #### int T_IV unsigned T_UV unsigned int T_UV UV T_UV T_UV sv_setuv($arg, (UV)$var); #### Platform: osname=linux osvers=4.15.0-52-generic archname=x86_64-linux uname='linux andyhome 4.15.0-52-generic #56-ubuntu smp tue jun 4 22:49:08 utc 2019 x86_64 x86_64 x86_64 gnulinux ' config_args='-de -Dprefix=/home/andy/perl5/perlbrew/perls/perl-5.30.0 -Aeval:scriptdir=/home/andy/perl5/perlbrew/perls/perl-5.30.0/bin' hint=recommended useposix=true d_sigaction=define useithreads=undef usemultiplicity=undef use64bitint=define use64bitall=define uselongdouble=undef usemymalloc=n default_inc_excludes_dot=define bincompat5005=undef Compiler: cc='cc' ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' optimize='-O2' cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include' ccversion='' gccversion='7.4.0' gccosandvers='' intsize=4 longsize=8 ptrsize=8 doublesize=8 byteorder=12345678