1 2 3 4 5 6 7 8 9 10 11 12 13 14
#!/usr/bin/perl use strict; use warnings; my $sub1 = sub { my $sub2 = sub { if (1==1) { return; } }; $sub2->(); print "zweiter Level\n"; }; $sub1->(); print "ganz oben\n"; exit();
Quoted:\perl>perl test.pl
zweiter Level
ganz oben
Quoted:\perl>perl test.pl
ganz oben
1 2 3 4 5 6 7 8 9 10 11 12 13 14
my $sub1 = sub { my $sub2 = sub { my $boo = shift // 42; if ($boo==1) { goto GANZOBEN } }; my $bar = shift; $sub2->( $bar * 2); print "zweiter Level\n"; }; $sub1->(.5); GANZOBEN: print "ganz oben\n"; exit();