# This software is Copyright 2005 by Elsevier Inc. You may use it # under the terms of the license at http://perl.plover.com/hop/LICENSE.txt . ### ### upto ### ## Chapter 4 section 2.1 sub upto { my ($m, $n) = @_; return sub { return $m <= $n ? $m++ : undef; }; } my $it = upto(3,5); my $value->it(); print "$value\n"; #### sub upto { my ($m, $n) = @_; return Iterator { return $m <= $n ? $m++ : undef; }; } sub Iterator (&) { return $_[0]; }