Alex Rivera | Logout

Passing a Function Object and Calling it

Asked 2009-08-05T17:29:20.383
33

How do I pass a function, a, to function, b, and have b call a in Perl?

Edit
Report

1 Answer

4

Following up to Eli Courtwright's example: If you only use the first function once, you could also call b with an anonymous function, like this:

b( sub { print "Hello World\n"; } );
answered 2009-08-05T18:25:04.530

Your Answer