How can I interpolate a Perl hash element in a string?

How to print a hash from a string, as in

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

against

 print "\n[*] Query : " . $select { query }; 
+6
string perl hash
source share
1 answer

You may need to remove the extra spaces:

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

With a space after $select Perl thinks what you did with the interpolation of this variable and literally interpret the following text (including curly braces).

+10
source share

All Articles