in reply to A cleaner way of scoping variables

There is no answer in the general case of how that naked block could be avoided, but I find that do can often help group things like this better. (In this example, you could use a ternary so the do isn't even necessary, but I'll humour you and assume it stands for a more complex piece of code.)

{ my $bar = do { if( $foo ) { "true" } else { undef } }; print $bar; }

Makeshifts last the longest.