use strict; # ALWAYS! $a = LetterPrinter( "a" ); $b = LetterPrinter( "b" ); $a->(); # these can also be called with ampersand $b->(); # ie: &$b; sub LetterPrinter { my $letter = shift; return sub{ print $letter, $/ }; }