在下面
use strict;
use warnings;
my $foo = undef;
表达式
$foo . ''
和
"$foo"
两者都生产
Use of uninitialized value $foo in ... at ...
但下面的表达式给出了空字符串而没有警告:
$foo x 1
Anyone knows why? I mean, it's cool to have a nice stringification idiom ($_ x 1
is quite much shorter than defined ? "$_" : ''
), but it feels a bit weird.