use Inline CPP => 'DATA'; my $sum = add( 2, 4 ); print "$sum\n"; __DATA__ __CPP__ #include int add( int x, int y ) { return x + y; }