in reply to directory list

I know some people don't like glob, but I do.
my @images = map {glob} ( '*.gif', '*.jpg', '*.jpeg' );
Or you could glob the whole directory and then assume anythat was a file was an image... using -f as your check:
my @files = grep { -f } glob '*'; # warning! some elements in @files might not be images.