理解循环问题的perl
我正在寻找一些旧的perl代码,并且正在试图弄清楚这一语句的含义是什么 - 我已经完成了编程,但没有在perl中进行编程。对此陈述的艰难时期实际上意味着什么。
for ($xx = $x+1 ; $contents[$xx] !~ m/^\:1S\:XXX/ ; $xx++)
是否循环直到找到:1s:xxx
(
如果不是),那是什么意思?
有人可以帮忙吗?
谢谢
I'm looking at some old Perl code and I'm trying to figure out what does this statement exaclty mean - I have done programming, but not in Perl. Having a hard time with what this for statement actually means.
for ($xx = $x+1 ; $contents[$xx] !~ m/^\:1S\:XXX/ ; $xx++)
Is this looping until it finds :1S:XXX
If not, then what does this mean?
Can someone help with this?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能更加清楚:
但是,如果找不到,则永远不会找到 code>,如果找不到:xxx 。因此,如果在$ x+1的起点时或之后,在数组元素的开头找不到搜索的字符串,则我会考虑将$ xx定义。
在Perl Regexes
中:
可以在前面具有\
,但不需要它。This might be more clear:
However both this and your
for
loops forever if:1S:XXX
isn't found. So I would consider this which leaves $xx not defined if the searched string isn't found at the beginning of an array element at or after the starting point in $x+1.In perl regexes
:
can have\
in front but don't need it.