There is a project called "GiST" which is about indexing various
types of data in a Database.
One part of this Project is a system
called "Blobworld" which allows the user to search for similar images
by selecting and rating regions of an existing Image.
I don't know how "Perlish" this one is, but it could be worth a view.
.
you can test Blobworld.