In perl, the value of a block is the value of the last expression in a block. This is just a shorthand for return $var.
EDIT: Purists indicate that these blocks do not return values ββat all (e.g. in Scala, for example), so you cannot write:
my $x = if (cond) { 7 } else { 8 };
, eval do FILE - . :
sub f {
my $cond = shift;
if ($cond) { 7 } else { 8 }
}
if/else, , , , .