gpt4 book ai didi

perl - 在 Perl 中如何只注释掉一行的一部分?

转载 作者:行者123 更新时间:2023-12-01 21:17:47 25 4
gpt4 key购买 nike

如何在 Perl 中注释单行的一部分,例如以下行:

 if($clevel==0){#never happends}

我希望能够评论最后一个右括号,而无需换行。

最佳答案

如果真的那么重要,请使用源过滤。

# C_Style_Comments.pm
package C_Style_Comments;
use Filter::Simple;
FILTER { s{/\* .* \*/}{}gmx };
1;
<小时/>
$ perl -MC_Style_Comments -e 'print /* 5, No wait, I mean */ 3'
3

关于perl - 在 Perl 中如何只注释掉一行的一部分?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2818155/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com