package test; for (A..D) { *{$_}=sub{ print "my name is $_ \n"; }; } package main; test->A(); test->B(); $_="here"; test->C(); test->D(); output: my name is my name is my name is here my name is here
In reply to Re^2: how to get alias name of anonymous sub? (closure)
by gian
in thread how to get alias name of anonymous sub?
by gian
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |