实现代码如下:

sub test {
    my $head = "abc";
    my $tail = "def";
    my $full = "${head}_${tail}";
    print $full, "\n";
}

直接写成下面这样,在strict模式下是无法通过的。
实现代码如下:

my $full = "$head_$tail";

以上就是【perl用{}修饰变量名的写法分享】的全部内容了,欢迎留言评论进行交流!

赞(0) 踩(0)

与本文相关的软件

发表我的评论

最新评论

  1. 暂无评论