#!/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 ")
Run Code Online (Sandbox Code Playgroud)
我想以更易读的形式编写上面的代码
#!/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 ")
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
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 ");
Run Code Online (Sandbox Code Playgroud)