in reply to Split FileName

To elaborate a bit on FunkyMonk's response, the period (.), when used in regular expressions means "any character except1 the newline." The way split is to break a string into fields, throwing out the specified separator2, which is a regular expression. When I try splitting a string with /./, I get an empty array.

If you want to split a string on periods (.), you've got to escape it, with the backslash (\), so your split should look something like this:

@file = split(/\./, $file_name);
(which is exactly what FunkyMonk wrote).

Regex are fun, and an incredibly powerful part of Perl.


1: Usually.

2: Although you can keep it if you want, by surrounding the regex with parentheses.


emc

Information about American English usage here and here.

Any New York City or Connecticut area jobs? I'm currently unemployed.