my $x = 10; #case 1: if (1){ my $x = 5; } print $x; #prints 10 #case 2: my $x = 5 if (1); print $x; #prints 5