[PerlChina] 关于split函数的小问题
Havel Zhang
havel.zhang at gmail.com
Fri Aug 4 04:25:31 PDT 2006
hi everyone:
有一个小问题请教各位弟兄,是关于split函数的。
我要把一个字串分成两个字段,以'|'为分隔符,程序应该是:
@a = split /\|/','item_code|store_code';
print join("\n", at a);
出来的结果是:
item_code
store_code
而我将程序改为:
@a = split "|",'item_code|store_code'; #把"|"改成"\|" 也一样
print join("\n", at a);
出来的结果是:
i
t
e
m
-
c
o
d
e
|
s
t
o
r
e
-
c
o
d
e
不知有哪位弟兄能指点一下,split中//和""的不同?
--
真理使你自由
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/china-pm/attachments/20060804/2d451868/attachment.html
More information about the China-pm
mailing list