码迷,mamicode.com
首页 > 其他好文 > 详细

perl 函数入门

时间:2015-08-03 13:00:13      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:

sub sum_of_fred_and_barney{
    print "Hey,you called the sum_of_fred_and_barney subroutine!\n";
    $fred+$barney;
}
$fred  =3;
$barney=4;
$wilma =&sum_of_fred_and_barney;
print "\$wilma is $wilma.\n";
$betty =3*sum_of_fred_and_barney;
print"\$betty is $betty.\n";

结果:

Hey,you called the sum_of_fred_and_barney subroutine!
$wilma is 7.
Hey,you called the sum_of_fred_and_barney subroutine!
$betty is 21.

 

perl 函数入门

标签:

原文地址:http://www.cnblogs.com/daimakun/p/4698893.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!