Why does this Perl function return a value?
$hi = do_this('asdf');
sub do_this
{
$blob{'f'} = {
'k' => 'j'
};
}
print $hi->{'k'};
# prints j
since do_开发者_如何学Gothis doesn't return anything, how does it still print j?
http://perldoc.perl.org/functions/return.html
In the absence of an explicit return, a subroutine, eval, or do FILE automatically returns the value of the last expression evaluated
All Perl 5 subroutines return the last value of the last statement executed.
精彩评论