简体   繁体   English

如何在字符串中插入Perl哈希元素?

[英]How do I interpolate a Perl hash element in a string?

How do I print a hash from within a string, as in 如何在字符串中打印哈希,如

print "\n[*] Query : $select { query }";

versus

print "\n[*] Query : " . $select { query };

You may need to eliminate the extra spaces: 您可能需要消除额外的空间:

print "\n[*] Query : $select{query}";

With a space after $select , Perl thinks that you are done with the interpolation of that variable, and treats the following text (including the curly braces) literally. 使用$select之后的空格,Perl认为你完成了该变量的插值,并按字面意思处理以下文本(包括花括号)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM