#!perl -w use warnings; use strict; use Inline C => Config => USING => 'ParseRegExp', BUILD_NOISY => 1; use Inline C => <<'EOC'; void foo(char * x, int y) { PerlIO_write(PerlIO_stderr(), x, y); } EOC my $str = "hello world\n"; foo($str, length($str)); foo($str, 8); __END__ Outputs: hello world hello wo