perl do
来源:互联网 发布:三个网站域名 编辑:程序博客网 时间:2024/06/10 04:26
do BLOCK Not really a function. Returns the value of the last command in the sequence of commands indicated by BLOCK. When modified by the "while" or "until" loop modifier, executes the BLOCK once before testing the loop condition. (On other statements the loop modifiers test the conditional first.)do BLOCK 不是一个真正的函数,返回BLOCK里最后命令的返回值。当返回值被while 或者 until 循环修改,在测试循环条件开始前执行BLOCK "do BLOCK" does *not* count as a loop, so the loop control statements "next", "last", or "redo" cannot be used to leave or restart the block. See perlsyn for alternative strategies.do BLOCK 不统计称为一个循环,因此循环控制着语句如next last 或者redo不能用于脱离还是重启block do SUBROUTINE(LIST) This form of subroutine call is deprecated. SUBROUTINE can be a bareword, a scalar variable or a subroutine beginning with "&".do 子函数列表 这种形式的子程序调用时不推荐的,子函数可以是bareword 标量变量或者子函数 以&开头。 do EXPR Uses the value of EXPR as a filename and executes the contents of the file as a Perl script. do 'stat.pl'; is just like eval `cat stat.pl`; except that it's more efficient and concise, keeps track of the current filename for error messages, searches the @INC directories, and updates %INC if the file is found. See "@INC" in perlvar and "%INC" in perlvar for these variables. It also differs in that code evaluated with "do FILENAME" cannot see lexicals in the enclosing scope; "eval STRING" does. It's the same, however, in that it does reparse the file every time you call it, so you probably don't want to do this inside a loop.除非是更有效和简明的,跟踪当前文件的错误信息,搜索@INC中定义的目录,更新 %INC 如果文件被找到 建议不要使用do 在一个循环里,每次调用都会重新解析文件 If "do" can read the file but cannot compile it, it returns "undef" and sets an error message in $@. If "do" cannot read the file, it returns undef and sets $! to the error. Always check $@ first, as compilation could fail in a way that also sets $!. If the file is successfully compiled, "do" returns the value of the last expression evaluated. do可以读文件但是不能编译它,它返回"undef" 存储错误信息到$@如果do 不能读文件 返回undef 写入$! 首先核对$@ Inclusion of library modules is better done with the "use" and "require" operators, which also do automatic error checking and raise an exception if there's a problem. You might like to use "do" to read in a program configuration file. Manual error checking can be done this way: # read in config files: system first, then user for $file ("/share/prog/defaults.rc", "$ENV{HOME}/.someprogrc") { unless ($return = do $file) { warn "couldn't parse $file: $@" if $@; warn "couldn't do $file: $!" unless defined $return; warn "couldn't run $file" unless $return; } }
0 0
- perl do
- perl do()用法
- Perl - How do I set environment variables
- Do you still program in Perl?
- perl/awk/sed do a issue
- Learning Perl: 1.4. How Do I Make a Perl Program?
- perl 报错 Can't do inplace edit without backup
- Perl 之 use(), require(), do(), %INC and @INC
- do
- perl和tcl 在验证中 (附do文件例子)
- perl unload mysql utf-8字符集 需要设置$dbh->do("SET NAMES utf8");
- do do
- perl
- Perl
- perl
- perl
- Perl
- perl
- 数据库oracle--PL/SQL的使用-禁止生成备份文件 .~sql
- 七巧板平台html5游戏开发之初识物理引擎
- 安卓Adapter用法
- 【小功能2】android获取手机信息(号码,内存,CPU,分辨率,MAC,IP,SD卡,IMEI,经纬度,信号强度等等)
- 树和二叉树 浅析
- perl do
- 深度优先搜索(DFS)算法
- Windows下安装pip管理scikit-learn
- EventListner机制在Hibernate3 和 Hibernate4中的区别
- 软件生命周期模型优缺点
- 怎么安装jseclipse插件
- 垂直对齐:vertical-align属性(转)
- firefox开发 Npapi控件
- javafX初探(密码域)