On Thu, Feb 3, 2011 at 10:47 AM, Harry Putnam <reader@newsguy.com> wrote:
> I used this in my crude little starter program as one part of a
> foreach loop:
>
> if ( !/^.*\.[bjgtp][gimnps][gfadp]$/) {
> print "<$_> is not a properly named image file .. skipping\n";
> next;
> }
>
> Just so I'd have output so as to trace any problematic files if there
> seemed a need. The regex appears to encompass all the types I want to
> deal with, but is no doubt horribly written.
>
> Its intended to allow:
>
> jpg, tif, bmp, gif, tga, png, psd And to reject anything else and just
> skip it. I think that's all, but may be leaving out some less common
> types. I'd sooner only deal with types listed there.
unless($filename =~ m(.+\.(bmp|gif|jpg|png|psd|tga|tif)$))
{
print STDERR "The filename {$filename} has an unsupported
extension. Skipping...";
next;
}
--
Brandon McCaig <http://www.bamccaig.com/> <bamccaig@gmail.com>
V zrna gur orfg jvgu jung V fnl. Vg qbrfa'g nyjnlf fbhaq gung jnl.
Castopulence Software <http://www.castopulence.org/> <bamccaig@castopulence.org>
Thread Previous
|
Thread Next