Why does the Perl function return a value?

$hi = do_this('asdf'); sub do_this { $blob{'f'} = { 'k' => 'j' }; } print $hi->{'k'}; # prints j 

since do_this returns nothing, how is it still printing j?

+6
perl
source share
2 answers

http://perldoc.perl.org/functions/return.html

In the absence of an explicit return, a routine, eval, or FILE automatically returns the value of the last expression evaluated

+25
source share

All Perl 5 routines return the last value of the last statement executed.

+4
source share

All Articles