Why doesn't Perl support double quotation hash interpolation?
#!/usr/bin/perl use warnings; my %hash=("no1"=>1, "no2"=>2, ); print %hash; #Prints no11no22 print "%hash"; #Prints %hash Why doesn't Perl support double-quote hash interpolation? It supports interpolation for scalars ($), arrays (@), why not for hashes (%)?
How should a hash be scribbled? Scalars are obvious and arrays too. But what should be the hash? How useful would such a strobification be? Is this more or less useful than being able to use the% unescaped character in an interpolation string? Is it worth the effort to fix all the code that% uses in interpolated lines today?
If you can find good answers to these questions, I am sure that P5P will want to listen to them.
Not quite the answer to the question βwhy,β but I thought I wanted to point out the various answers to the βhow.β
You can, of course, try:
#!/usr/bin/perl use warnings; use strict; my %hash = ( "no1" => 1, "no2" => 2, ); print "@{[ %hash ]}\n"; But I do not know what use will be.
If you want to dump the contents of a hash or any other complex data structure, use Data :: Dumper or YAML or JSON depending on your use case.