Skip to content

Instantly share code, notes, and snippets.

@diakopter
Created June 1, 2012 16:10
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 diakopter/2853248 to your computer and use it in GitHub Desktop.
Save diakopter/2853248 to your computer and use it in GitHub Desktop.
use Test;
{
my $depth = 0;
my $c = 1;
sub a {
++temp $c;
a() if ++$depth < 3;
}
a();
is $c, 1, 'recursive nested temps are restored properly';
}
{
my $a=1;
{
temp $a=2;
temp $a=3;
}
is $a, 1, 'multiple temps in the same scope are restored properly';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment