字符串中数组的内插

内插时会在数组的各个元素之间插入空格。

($”进行指定,默认是空格)

use 5.014;
my @draws = qw(david xinxin huahua);
$" = "<!>";
say @draws;    #没内插不进行分割 davidxinxinhuahua
say "@draws";  # david<!>xinxin<!>huahua

 

内插数组中的某个元素时,会被替换成该元素的值.

@fred = qw(hello dolly);
$y =2 ;
$x = "This is $fred[1]'s place";  # This is dolly's place
posted @ 2013-09-09 11:03  新闻官  阅读(366)  评论(0编辑  收藏  举报