Advertisement
Guest User

Untitled

a guest
Aug 13th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.39 KB | None | 0 0
  1. #!/usr/bin/perl
  2. use strict;
  3. use warnings;
  4.  
  5. use feature 'say';
  6.  
  7. sub foo
  8. {
  9.         my $count = 0;
  10.         return (
  11.                 sub
  12.                 {
  13.                         return $count++;
  14.                 },
  15.                 sub
  16.                 {
  17.                         return $count++;
  18.                 }
  19.         );
  20. }
  21.  
  22. my ($a, $b) = foo;
  23. say $a->();
  24. say $b->();
  25. say $a->();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement