Perl中的空格字符是什么?
我想要这个输出Perl中的空格字符是什么?,perl,space,Perl,Space,我想要这个输出 "type":"test test" 我不想在命令中使用空格。 我想要一个代表单个空格的字符,我知道我不能使用\s 有什么东西我可以用吗 print "\"type\":\"test(space character should be here )test\"; 只需使用空格键: print "\"type\":\"test test\""; #
"type":"test test"
我不想在命令中使用空格。
我想要一个代表单个空格的字符,我知道我不能使用\s
有什么东西我可以用吗
print "\"type\":\"test(space character should be here )test\";
只需使用空格键:
print "\"type\":\"test test\"";
# ^
最好的解决方案是直接使用空格键:
print q("type":"test test"); # Changed delimiter for fewer escapes
但是如果你想,你也可以使用
\x20,表示“空格”的ASCII码,或
\N{SPACE},普通空间的Unicode字符名还有很多。
\N{U+0020},正规空间的Unicode码点。
…
请注意,这些仅适用于双引号字符串,例如qq
如果您想使用charname路由,则必须在Perl 5.16之前加载charnames模块:
use charnames ':full';
从5.16开始,一旦找到{…}转义符,该模块将自动加载
默认情况下,$变量包含一个空格–此变量的内容在插入数组时用于连接数组的内容。为什么不使用print q{type:test};使用“”没有什么作用?