","a","b","c");print "\n"' a=>b=>c /home/lee#perl -e 'print join(":","a"," name="description" />
join语法:
join EXPR,LIST
如:
/home/lee#perl -e 'print ("a","b","c");print "\n"'
abc
/home/lee#perl -e 'print join("=>","a","b","c");print "\n"'
a=>b=>c
/home/lee#perl -e 'print join(":","a","b","c");print "\n"'
a:b:c
join函数让EXPR中的值包围着LIST里的串,然后返回整个串!EXPR也可以拥有多个字符!
split语法:
split
split /PATTERN/
split /PATTERN/,EXPR
split /PATTERN/,EXPR,LIST
这里,split函数在串PATTERN出现的每个地方将串EXPR分开.例子:
/home/lee#perl -e 'print ((split " ","hello world")[1]);print "\n"'
world