Starting with Inline::C 

#!/usr/bin/perl

use Inline C => <<'END_C';

void greet() {
    printf("Hello, world\n");
}
END_C

greet();