======= 2011-06-30 16:22 gary.jsz@gmail.com 您在来信中写到:答复: [PerlChina] 问一道题目 =======
大家好!
子例程可以通过&subname来访问并返回值,但是,如果此子例程里面有N个变量,我如何才能得到子例程里面的变量值? 举个小例子,比如:
#!/usr/bin/perl -w
sub output{
my $host_name = 12345;
my $kernel = "2.6.35";
my $version = "Redhat enterprise linux";
print "$host_name\n $kernel\n $version\n";
}
使用 &output输出,把左右的都打印出来了,如果我output子例程的print语句不用,那么,我如何得到output的$kernel输出?
谢谢!
----
Gary.jsz
Gary.jsz
= = = = = = = = = = = = = = = = = = = =
----
Gary.jsz
Gary.jsz
没有评论:
发表评论