#!/usr/bin/perl
use strict;
use warnings;


# Return a function that adds n to its input.
sub add_n_factory {
  my $n = shift;
  my $add_n = sub { return $n + shift };
  return $add_n;
}


my $add_5 = add_n_factory(5);
my $add_6 = add_n_factory(6);

print " 5 past 10 is" . $add_5->(10) . "\n";
print " 6 past 10 is" . $add_6->(10) . "\n";

# So the question is ...
#   where is the '5' being stored?


