The best you can do to get this kind of interaction (at least continuing to pursue this avenue) is via shared memory.
will permit you to share native Perl variables (basically a shared chunk of memory, using
). I believe something like
will do precisely what you need, as this is (I believe) a simple interface to the raw memory, so it might be easier to use a binary data structure here so that you can easily pull what you need and use it either in C or Perl.