Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- my $code = do {
- my $x = 1;
- my $y = 0;
- my $next;
- $next = sub {
- ($y, $x) = ($x, $x + $y);
- return ($next, $x);
- };
- };
- my $value;
- while($code) {
- ($code, $value) = $code->();
- print "Next value is: $value \n";
- if ($value > 100000000) { last };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement