use strict; use warnings; use Inline C => Config => BUILD_NOISY => 1; use Inline C => <<'EOC'; void foo(SV * a, ...) { dXSARGS; int i, t; /* add new values onto the end of the stack */ for(i = 0; i < items; i++) { t = SvIV(ST(i)) * 3; XPUSHs(newSViv(t)); } for(i = 0; i < items * 2; i++) { printf("%d\n", SvIV(ST(i))); } } void bar(SV * a, ...) { dXSARGS; int i, t; /* overwrite the existing stack values with new ones */ sp = mark; for(i = 0; i < items; i++) { t = SvIV(ST(i)) * 3; XPUSHs(newSViv(t)); } for(i = 0; i < items; i++) { printf("%d\n", SvIV(ST(i))); } } EOC foo(1 .. 5); print "\n"; bar(1 .. 4);