#!/usr/local/bin/perl -l sub horror { my $foo if "reset" eq shift; print ++$foo; } horror($_) for qw(foo bar baz reset bing bang boom); __END__ 1 2 3 4 1 2 3