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: