in reply to Getopt::Long::GetOptions checking input array for file extensions

Hello again thanos1983,

Glad to see from the final update that you’ve got the solution you were looking for. One point: in the regex

/.xls$/

Perl treats the dot as a metacharacter which means “Match any character (except newline)”.1 So the regex matches a file name ending in the letters “xls” preceded by any character. To match a full stop only, you need to backslash it:

/\.xls$/

In most cases, this won’t make any difference to your results, but if you happened to have a file named “abcxls” this would currently be matched incorrectly.

1See “Metacharacters” in perlre#Regular-Expressions.

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Replies are listed 'Best First'.
Re^2: Getopt::Long::GetOptions checking input array for file extensions
by thanos1983 (Parson) on Aug 08, 2014 at 17:51 UTC

    Hello Athanasius,

    Nice!!! I am not really familiar with the "regex" so any advice is always welcome. I have been observing this backslash in several examples with "regex" and I was not able to understand the reason of existence.

    Thanks for the tip, as a friend of mine says "The devil lays on the details". ;)

    Seeking for Perl wisdom...on the process...not there...yet!