
use feature "say";  #so we can use say
sub make_incrementor {
    my $n = shift;	#how many does he want to increment by
                    # this is local to the sub
    return sub {	#create an anonymous sub that will do the work
        my $x = shift; #when called what are we incrementing
        return $x + $n; 
    } #we return the reference to the anonymous sub
}

my $f3 = make_incrementor(3); #
my $f7 = make_incrementor(7);

say $f3->(2);    #  5
say $f7->(3);    # 10
say $f3->(4);    #  7
say $f7->(10);   # 17
