为什么“say "%hash"”的工作方式与它对标量和数组的工作方式不同?
#!/usr/bin/perl
use strict;
use warnings;
use Modern::Perl;
use Test::More;
my $s = "Hello, World!";
say $s;
say "$s";
my @a = ("Hello", "World!");
say @a;
say "@a";
my %h = ("Hello", "World!");
say %h;
say "%h";
D:\TEST\perl>perl 1.pl
Hello, World!
Hello, World!
HelloWorld!
Hello World!
HelloWorld!
%h
最佳答案
因为它会搞砸 printf
语法?
%d = ('key' => 'value');
printf "The answer is %d\n", 4; # is %d a format symbol or the hash table?
关于perl - 为什么 'say "%hash"' 的工作方式与它对标量和数组的工作方式不同?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4682413/