programming-examples/perl/Subroutine/Return a subroutine from a subroutine.pl
2019-11-15 12:59:38 +01:00

9 lines
191 B
Perl

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