Why doesn't Perl support interpolation of hashes in double quotes?

后端 未结 3 1248
不思量自难忘°
不思量自难忘° 2021-01-02 13:31
#!/usr/bin/perl
use warnings;

my %hash=(\"no1\"=>1, 
        \"no2\"=>2,
      );

print %hash; #Prints no11no22
print \"%hash\"; #Prints %hash
3条回答
  •  暖寄归人
    2021-01-02 14:14

    To quote Nathan Torkington: "The big problem is that % is heavily used in double-quoted strings with printf." More information is here.

提交回复
热议问题