For learning purposes, I am toying around with the idea of building event-driven programs in Perl and noticed that it might be nice if a subroutine that was registered as an
If you don't change $cb's value again, you can use that. If not, define a scalar to hold that and don't change it ever again. For example:
$cb
my $cb = do { my $sub; $sub = sub { contents using $sub here } }