Split:
Perl中的一个非常有用的函数是Perl split函数-把字符串进行分割并把分割后的结果放入数组中。

例1:

$info="Caine:Michael:Actor:14,LeafyDrive";  
@personal=split(/:/,$info);  

result:@personal=("Caine","Michael","Actor","14,LeafyDrive");

例2:

$_="Capes:Geoff::Shotputter:::BigAvenue";  
@personal=split(/:+/);  

result:@personal=("Capes","Geoff","Shotputter","BigAvenue");

例3:

$_="Capes:Geoff::Shotputter:::BigAvenue";  
@personal=split(/:/);  

result:@personal=("Capes","Geoff","","Shotputter","","","BigAvenue");