#!/usr/bin/perl -w use strict; use Inline 'C'; explain($_) for qw( foo bar bat baz qux ); __DATA__ __C__ /* don't need to include std C headers... perl.h header (included by default with Inline) includes them */ /* define this first so explain() can see it */ char *inflect(int num) { return num == 1 ? "st" : num == 2 ? "nd" : num == 3 ? "rd" : "th"; } void explain(char *var) { static int i = 1; printf("%s is the %d%s meta-syntactic variable.\n", var, i, inflect(i) ); ++i; }