in reply to Technique for building arguments from function name?
use strict; use warnings; sub make_animal_subs { my $animal = shift; return sub{print $animal, "\n";}; } my $function_tiger = make_animal_subs('tiger'); my $function_dog = make_animal_subs('dog'); $function_tiger->(); &$function_dog(); # Or use the alternate syntax.
UPDATE: Sorry, I had not seen haukex's similar post.
|
|---|