您如何评论Perl正则表达式? [英] How do you comment a Perl regular expression?

查看:105
本文介绍了您如何评论Perl正则表达式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Perl正则表达式中添加注释?

How do you put comments inside a Perl regular expression?

推荐答案

使用/x修饰符:

my $foo = "zombies are the bombies";
if ($foo =~ /
             zombie  # sorry pirates
            /x ) {
    print "urg. brains.\n";
}

另请参见

Also see the first question in perlfaq6.

在阅读过程中阅读所有 perlre 也不会有什么害处

Also it wouldn't hurt to read all of perlre while you're at it.

这篇关于您如何评论Perl正则表达式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆