如何跳转到Perl中的特定输入行?
发布时间:2020-12-15 21:49:06 所属栏目:大数据 来源:网络整理
导读:我想跳到包含“include”的第一行. until /include/; 为什么这不起作用? 解决方法 匹配运算符默认使用$_但是默认情况下,运算符不存储到$_,除非它在while循环中使用,因此$_中没有存储任何内容. 来自perldoc perlop: I/O Operators ... Ordinarily you must
我想跳到包含“include”的第一行.
<> until /include/; 为什么这不起作用? 解决方法
匹配运算符默认使用$_但是<>默认情况下,运算符不存储到$_,除非它在while循环中使用,因此$_中没有存储任何内容.
来自perldoc perlop: I/O Operators ... Ordinarily you must assign the returned value to a variable,but there is one situation where an automatic assignment happens. If and only if the input symbol is the only thing inside the conditional of a "while" statement (even if disguised as a "for(;;)" loop),the value is auto |