[oracle@june2 perl]$ cat a2.pl 
sub get_value()
{
my $var;
$var = 100;
return 200;
return($var);
};
$var = get_value;
print "\$var is $var\n";
[oracle@june2 perl]$ perl a2.pl
$var is 200


返回值是200



[oracle@june2 perl]$ cat a2.pl
sub get_value()
{
my $var;
$var = 100;
return($var);
};
$var = get_value;
print "\$var is $var\n";
[oracle@june2 perl]$ perl a2.pl
$var is 100

返回值是100


return是结束正在运行的函数,并返回函数值 相当于=return + exit