This is due to
closures. With the braces, your first sub,
do_a is defined within the lexical scope that sets
$var to 'first var'. In other words:
{
my $var = 'first var'; # sets $var for this block
# defines a sub IN this block, so gets this $var
sub do_a {
print "In 'aaa' var is set to '$var'\n";
}
}
Because subroutine names are available globally, do_a can be called from anywhere, but gets the $var defined in its lexical block.
Similarly, do_b is defined in a block where $var is set to nothing, and do_c is in a block with no $var at all.