JD.*_*JD. 0 perl string-interpolation
即使它是双引号,并且%s
应该插入到不存在的哈希,这是有效的Perl和输出"confusing = true"
.
#!/usr/bin/perl -w
use strict;
my $what = "confusing = %s";
printf $what, "true";
Run Code Online (Sandbox Code Playgroud)
但是,这是无效的(如预期的那样),因为$ s不存在:
my $what = "confusing = $s";
Run Code Online (Sandbox Code Playgroud)