in reply to Re^2: Why callbacks?
in thread Why callbacks?
I presume this was asked before I moved the brace, but even then no. The scalar would have (which is why I made the correction), but the subroutine sticks around (they're not lexically declared). Had I done this:
{ my $returned_data = []; my $callback = sub { push @{ $returned_data }, $_[0] }; } something_wanting_callback( $callback );
Then yes, that coderef would have gone out of scope.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Why callbacks?
by pileofrogs (Priest) on Mar 30, 2007 at 17:32 UTC | |
by Fletch (Bishop) on Mar 30, 2007 at 17:41 UTC |