perl用{}修饰变量名的写法分享
更新时间:2020年6月29日 13:42 点击:2588
复制代码 代码如下:
sub test {
my $head = "abc";
my $tail = "def";
my $full = "${head}_${tail}";
print $full, "\n";
}
直接写成下面这样,在strict模式下是无法通过的。
复制代码 代码如下:
my $full = "$head_$tail";
相关文章
- 在perl中用{}修饰变量名,可以防止 _ 被解释为变量名的一部分...2020-06-29