use strict; use warnings; sub print_power_of_2 { my $x = shift; my $result = power_of_2(); print "$x^2 = $result\n"; sub power_of_2 { return $x ** 2; } } print_power_of_2(5); print_power_of_2(6); #### sub print_power_of_2 { my $x = shift; my $result = power_of_2(); print "$x^2 = $result\n"; my $power_of_2 = sub { return $x ** 2; }; }