perl用{}修饰变量名的写法分享
2012年11月30日
sub test {
my $head = "abc";
my $tail = "def";
my $full = "${head}_${tail}";
print $full, "n";
}
直接写成下面这样,在strict模式下是无法通过的。
my $full = "$head_$tail";
sub test {
my $head = "abc";
my $tail = "def";
my $full = "${head}_${tail}";
print $full, "n";
}
my $full = "$head_$tail";