Anonymous Functions

Learn about anonymous functions in Perl.

An anonymous function is a function without a name. It behaves exactly like a named function—we can invoke it, pass it arguments, return values from it, and take references to it. Yet, we can access an anonymous function only by reference, not by name.

A Perl idiom known as a dispatch table uses hashes to associate input with behavior:

Get hands-on with 1200+ tech skills courses.