my $bar = 41; foo($bar); print $bar; use Inline C => <<'EOC'; void foo(SV* bar) { int b = (int)SvIV(bar); b++; sv_setiv(bar,b); } EOC