Japhy pointed out this particular syntax to me. Before this, I was using
@files = grep {/jpe?g$/i} readdir DIR;

Can someone let me know what effectively is the difference between
@files = grep {/jpe?g$/i} readdir DIR;
and
@files = grep /jpe?g$/i, readdir DIR;
?

Or is there any?

On 06/07, Pete Emerson rearranged the electrons to read:
> ...and just to include both .jpg and .jpeg like John's program:
> 
> opendir DIR, "./" or die "can't open $directory: $!\n";
> @files = grep /jpe?g$/i, readdir DIR;
> 
> Nice code, Shawn. I must admit that my original way of doing this was even worse
> than John's (by not using opendir and closedir). Zoiks. Guess that's why I'm
> reading this list!
> 
>     Pete
> 
> Shawn wrote:
> 
> > opendir DIR, $directory or die "can't open $directory: $!\n";
> > @files = grep /jpg$/i, readdir DIR;
> >
> > On 06/07, John Storms rearranged the electrons to read:
> 
> [ snip ]
> 
--
Hob Goblin
[EMAIL PROTECTED]

"Pinky, you've left the lens cap of your mind on again." - The Brain

Reply via email to