in reply to how to get alias name of anonymous sub?
Don't hide the information in the subroutine name. Instead, just use a closure:
foreach( keys %news_sites ) { my $name= $_; *{$_}= sub { get %news_sites{$name}; ... }; }
Update: Or
foreach( keys %news_sites ) { my $site= $new_sites{$_}; *{$_}= sub { get $site; ... }; }
- tye
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how to get alias name of anonymous sub? (closure)
by gian (Novice) on Nov 29, 2010 at 07:28 UTC | |
by tye (Sage) on Nov 29, 2010 at 08:04 UTC |