#!/usr/bin/perl
use warnings;
system ("dialog --menu Customize 10 70 50 'Flush rules' 'Clear all the rules' 'Show rules' 'Shows the current rules' 2> /tmp/tmp.txt ")

我想以这样更易读的形式编写上面的代码
#!/usr/bin/perl
use warnings;
system ("dialog --menu Customize 10 70 50
'Flush rules' 'Clear all the rules'
'Show rules' 'Shows the current rules'
'more options' '........' 2> /tmp/tmp.txt ")

我怎样才能做到这一点?

最佳答案

Perl 提供了一个字符串连接运算符,您可以使用它来构建大字符串:

system ( "dialog --menu Customize 10 70 50 "
       . "'Flush rules' 'Clear all the rules' "
       . "'Show rules' 'Shows the current rules' "
       . "'more options' '........' 2> /tmp/tmp.txt ");

关于perl - 如何在此 Perl 代码中进行转义?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7208623/

10-11 18:14