Jim Gibson <jimsgib...@gmail.com> writes:

> On 2/4/11 Fri  Feb 4, 2011  8:02 AM, "Harry Putnam" <rea...@newsguy.com>
> scribbled:
>
>> 
>> One further question.  In your formulation shown below:
>> ,---- 
>> |     unless($filename =~ m(.+\.(bmp|gif|jpg|png|psd|tga|tif)$))
>> |     {
>> |         print STDERR "The filename {$filename} has an unsupported
>> | extension. Skipping...";
>> |         next;
>> |     }
>> `----

[...] snipped very helpful detailed explanations

> You can use other characters to make it more readable. However, all of the
> normal delimiters such as {} and [] have other meanings within the regular
> expression. Some overlap of meaning is unavoidable, and context-awareness is
> required on the part of the reader.

I notice that in the OPs code and in your examples, the forward slash
is not used at all.... When you say above that "all the normal
delimiters [...]" .. but forward slashes `//' do not have special
meaning inside and would seem then to be ideal char for delimiters.

Yet they seem to be carefully avoided.  That is what I nearly always
use.  Is there some reason to avoid `//' as delimiters?

[...]

>> Would `\w+' have served better or am I really missing the boat all
>> the way round? 
>> 
>
> It all depends upon what you want to match and what you want to exclude.
> Some file names will not be matched by \w+\.(jpg|png|...)

Do you mean legitimate Image files?  Can you give an example... I'm
not visualizing what they would look like.  

ps - Thanks for the detailed explanations of the finer points.


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to