It works very vell. However, I am not completely satisfied with i as it's unnecessarily loading larger data set than it absolutely must. Besides, I'd also like to get some experience in DB programming. That's why the PL/Perl way seems pretty attractive to me.
Try it them. But bear in mind you are not *unnecessarily* loading the data set, the server will need to load it to apply the plperl filters, you will just avoid loading it in the client and transmitting it. You are making a trade off, a design decission. You are trading some network and client cpu usage for some server cpu usage and coding complexity. The tricky part is the the coding complexity, which needs a lot of resources you may never recover. Part of the experience in DB programming is knowing what NOT to do in the database, so coding this will be good, the worst thing that could happen is you do it and then drop it after learning one thing.