We will briefly discuss how to create Perl functions and use them in triggers. Some of you might ask when it is beneficial to use PL/Perl, since PostgreSQL supports a variety of languages that can be used to create triggers or write stored procedures/functions.
You might be more familiar with a language such as Perl than with Python or Tcl. This is a pretty good reason to choose a certain language over the other.
However, if the performance of the function is one of your considerations, then you might want to choose a language based on the nature of the code you want to write.
In general, PL/Perl will outperform PL/pgSQL, if the focus of the stored procedure is computational tasks, athematic, and string parsing and manipulation. However, PL/pgSQL will often be a clear winner if you need to access the database. PL/pgSQL is closely tied into the PostgreSQL execution engine and has a very low overhead of running a query, compared to other procedural languages.