perl 的eval中,不应当使用 next
2011-12-08 16:52
176 查看
The next command is like the continue statement in C; it starts the next iteration of the loop:
LINE: while (<STDIN>) {
next LINE if /^#/; # discard comments
#...
}
Note that if there were a continue block on the above, it would get executed even on discarded lines. If the LABEL is omitted, the command refers to the innermost enclosing loop.
next cannot be used to exit a block which returns a value such as eval {} , sub {} or do {} , and should not be used to exit a grep() or map() operation.
Note that a block by itself is semantically identical to a loop that executes once. Thus next will exit such a block early.
LINE: while (<STDIN>) {
next LINE if /^#/; # discard comments
#...
}
Note that if there were a continue block on the above, it would get executed even on discarded lines. If the LABEL is omitted, the command refers to the innermost enclosing loop.
next cannot be used to exit a block which returns a value such as eval {} , sub {} or do {} , and should not be used to exit a grep() or map() operation.
Note that a block by itself is semantically identical to a loop that executes once. Thus next will exit such a block early.
相关文章推荐
- Perl中的alarm、eval、die的联合使用
- Perl eval函数使用实例
- perl eval两种使用方式
- linux下使用perl获取本机ip的几种方法介绍
- JavaScript 为什么不要使用 eval
- 为什么不要使用 eval
- 使用FindFirstFile,FindNextFile遍历一个文件夹
- lr_eval_string()函数以及LR中参数、变量的简单使用
- 关于perl中BEGIN和END的使用
- js中使用eval()方法将字符串转换成日期格式、并获取指定时间的日期
- perl中sprintf函数的使用方法。
- Perl遍历目录和使用Linux命令分析日志的代码实例分享
- perl--DBI使用详解(二)
- perl 数组的使用
- eval的使用
- Shell—eval命令使用
- 在Perl中使用xml-rpc的实例
- 在Perl中使用xml-rpc的实例
- lambda匿名函数小练习eval的使用Python3
- Perl引用简单使用