Locked in a Box: Basics of Closures in Perl5 & Raku

By Steven Lembark

Elevator Pitch

Closures – and anonymous subs in general – provide a simple, dynamic way to control code without huge if-blocks. Problem is that most people don’t know how to use them or why.

Description

This is an introduction to closures for people who haven’t used them before, describing lexical variables in subroutines and how the variables can be used in named and anonymous subroutines. The syntax will show how to use them in Perl5 and Raku with some examples of avoiding if-logic and simple inversion of control.

Notes

This should be a 20 minute talk – that option is not shown in the talk editor. This talk should go before the intermediate talk on how to use closures in Raku.