$ perl -E' use Config qw( %Config ); my $ptr_size = $Config{ptrsize}; my $ptr_format = $ptr_size == 4 ? "L" : $ptr_size == 8 ? "Q" : die("Unrecognized pointer size"); my $s = "abc"; my $ptr = unpack($ptr_format, pack("p", $s)); say sprintf "0x%x", $ptr; use Devel::Peek; Dump($s); ' 0x1766c40 SV = PV(0x174dcf0) at 0x176d958 REFCNT = 1 FLAGS = (PADMY,POK,pPOK) PV = 0x1766c40 "abc"\0 CUR = 3 LEN = 16