#case 2: my $x = 5 if (1); print $x; #prints 5 #### my $x=4 if(1); #x is as good as global for this file. if(1) { my $x=5; # x is visible inside the block for compiler so it makes it inside. }