The simplest thing to do is to compile the C program and run it from your Perl program. Use qx(), or open my $pipe, '-|', '/your/c/program', and just read its output. Unless I'm missing something, I don't see any reason to use Perl's syscall, unpack structs, allocate buffers and do other complicated things.