in reply to Re: C-like Pointers (unpack)
in thread C-like Pointers

Oops, I forgot that this requires an extra layer of indirection. I suspect that the number of environments where "I" is the wrong choice is very small. Strangely, I used "L" in Acme::ESP which seems a more fragile choice.

my $fmt= "I"; my $iBytes= length( pack $fmt, $fmt ); my $pBytes= length( pack "P", $fmt ); if( $iBytes != $pBytes ) { die "Your pointers are $pBytes bytes, ints are $iBytes"; } my $pointer= pack $fmt, 0x78000000; my $bytes= 4*1024; # Set to number of bytes to copy my $copy= unpack "P$bytes", $pointer;

- tye