Mega Code Archive

 
Categories / Perl / Subroutine
 

Return a subroutine from a subroutine

sub printem {     my $string1 = shift;     return sub {my $string2 = shift; print "$string1 $string2\n";}; } $hellosub = printem("Hello"); &$hellosub("today."); &$hellosub("there.");