Skip to content

Instantly share code, notes, and snippets.

@VadimPushtaev
Created July 18, 2014 12:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VadimPushtaev/58216fd01d99eef22dc3 to your computer and use it in GitHub Desktop.
Save VadimPushtaev/58216fd01d99eef22dc3 to your computer and use it in GitHub Desktop.
package My_Loop;
use strict;
use warnings;
our $AUTOLOAD;
sub AUTOLOAD {
my ($class, $method) = split /::/, $AUTOLOAD;
my ($prefix, $i) = split /_/, $method;
$i--;
my $next_method = "${prefix}_${i}";
print "$i\n";
return __PACKAGE__->$next_method;
}
sub loop_0 {}
__PACKAGE__->loop_13;
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment