please dont rip this site

Perl Function


split(delimeter, string);

Note that the delimeter is used as a part of a regular expression that splits the string. It is NOT a simple string. So if you try to split a file name at the period with split(".",$filename) you will get nothing. Useing split("\.", $filename) also doesn't work, be cause that just passes the "." to the regexp. You need to use split("\\.", $filename) so that split get a first parameter of "\." which perl apparently turns into a regexp of "m/\./".

For even more fun, try splitting $path = "C:\\perl\\bin" on the "\": split("\\", $path) just generates a lovely "Trailing \ in regex m/\/" error message. The secret? Two pair. split("\\\\",$path) works just great. Split actually gets "\\" which gets turned into "m/\\/" which then splits on "\".

If you try to just supply the string and not the delimiter, it takes the string from $_. i.o.w. delimeter is not optional

See also:

http://www.perldoc.com/perl5.6.1/pod/func/split.html

Questions:


file: /Techref/language/perl/split.htm, 2KB, , updated: 2008/4/17 12:48, local time: 2012/2/9 10:07,
TOP NEW HELP FIND: 
38.107.179.232:LOG IN

 ©2012 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE! / 

<A HREF="http://www.piclist.com/techref/language/perl/split.htm"> Perl Command split(delimeter, string)</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 
Feel the NEED for SPEED?
Ubicom SX18 thru SX52, PIC 16c5X compatibile, 50 to 75 MIPS  microcontrollers!
 
miSim DE is an excellent, portable and powerful IDE for developing PIC applications.
The only consistant, simple to use yet powerful development environment. It simulates real-world devices via virtual component "plugins" (LED,LCD,key,motor,TV,etc) in real time, has a syntax highlighting editor, macro assembler and disassembler. Regular updates and third-party plugins keep this software ahead of any other PIC IDE.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .