文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>子程序的参数列表

子程序的参数列表

时间:2007-01-03  来源:yszll

传递给子程序的参数列表放在一个名为@_的列表中。   #!/usr/bin/perl
# Fig 6.5: fig06_05.pl
# Demonstrating a subroutine that receives arguments.
displayArguments( "Sam", "Jones", 2, 15, 73, 2.79 ); # output the subroutine arguments using special variable @_
sub displayArguments
{
   # the following statement displays all the arguments
   print "All arguments: @_\n";
   # the following loop displays each individual argument
   for ( $i = 0; $i < @_; ++$i ) {
      print "Argument $i: $_[ $i ]\n";
   }
   $i = 0;
   for(@_) {
      print "\$_ is: $_\n";
      print "\$_[\$i] is: $_[$i]\n";
      ++$i;
   }
}
相关阅读 更多 +
排行榜 更多 +
我要当超人

我要当超人

休闲益智 下载
幸存者的命运

幸存者的命运

飞行射击 下载
精英战区3d

精英战区3d

飞行射击 下载