> 
> I thought I could solve the regex issue a different way, but failed.
> 
> My $path = "Mazda.1.jpg ";
> 
> ($file, $dir, $ext) = fileparse ($path, '\..*' );
> 
> #I'm trying to get Mazda.2.jpg and Mazda.3.jpg.
> # $file contains Mazda, so why does this regex fail to deliver
> Mazda.2.jpg 
> # and Mazda.3.jp? 
> 
> my @smaller = grep(/\$file\.(2|3)\.(gif|jpe?g)$/i, readdir(DIR));



Try as:

my $pathdir = "/path/to/images";
my $pathurl = "http://url/to/images";;

opendir(DIR, $pathdir) or die('Not opened directory');
my @bigger  = grep(/\.(1)\.(gif|jpe*g)$/i, readdir(DIR));
my @smaller = grep(/\.(2|3)\.(gif|jpe*g)$/i, readdir(DIR));
closedir(DIR);

For printing images in html files:

foreach (@bigger ) {
print "$pathurl/$_ <br>\n";
}

like this...


Maruf







-- 
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