in reply to Unwanted splitting of File Name
@nameFolders = grep { !/^\.|\.\.$/ } readdir(DIR);
(This reply is parenthetic to your main problem, well addressed by others. (No, not pathetic, parenthetic!)) Because of the high precedence of the | (ordered alternation) operator, the regex /^\.|\.\.$/ matches any string that either begins with a . (period) or that ends with two periods. This causes the grep to eliminate the . and .. directories, but potentially much else besides.
c:\@Work\Perl\monks>perl -wMstrict -MData::Dump -le "my @dirs = qw(. .. ... .abc ..abc xyz.. xyz. abc ab.c a..bc) +; @dirs = grep { !/^\.|\.\.$/ } @dirs; dd \@dirs; " ["xyz.", "abc", "ab.c", "a..bc"]
Better: /^\.\.?$/
|
|---|