Stout, Joel R [SJR], on Tuesday, December 7, 2004 at 00:55 (-0000)
typed:

SJR> use File::Basename;
SJR> $fullname = "/usr/local/pics/sample.tiff"; #for example
SJR> ($file,$dir,$_) = fileparse($fullname, qr/\..*/);
SJR> if (/\.(tif|tiff|jpg|jpeg)$/) {
SJR>     print "This is an image file.\n";
SJR> };

it depends, from where you have $filename, from readdir() or ?
I'm trying not to use modules, if I really don't need them, and in this
situation, I think, you don't need it.

And upper regex could be better written as:
if (/\.(tiff?|jpe?g)$/i ) {

-- 

 ...m8s, cu l8r, Brano.

[Help stamp out Pernography: read more LeGuin!]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to