Some techniques from the heady world of Functional Programming implemented in idiomatic Perl using various techniques: closures, iterators, Devel::Declare, and some distilled evil. New version now with monads! (As presented at http://conferences.yapceurope.org/lpw2008/ )
53. Sequencing my $x = 1; my $y = 2; my $z = $x * $y; say “$x * $y = $z”;
54. Sequencing my $x = 1; my $y = 2; my $z = $x * $y; say “$x * $y = $z”;
55. Sequencing my $x = 1; my $y = 2; my $z = $x * $y; say “$x * $y = $z”;
56. Sequencing my @seq = sub { my $x = 1 }, sub { my $y = 2 }, sub { my $z = $x * $y }, sub { say "$x * $y = $z" };
57. Sequencing my @seq = sub { my $x = 1 }, sub { my $y = 2 }, sub { my $z = $x * $y }, sub { say "$x * $y = $z" }; # Global symbol "$x" requires explicit package name at ...
58. Nesting my $x = 1; my $y = 2; my $z = $x * $y; say “$x * $y = $z”;
59. Nesting sub { my $x = 1; sub { my $y = 2; sub { my $z = $x * $y; sub { say "$x * $y = $z"; }->() }->() }->() }->();