PL/Perl

PL/Perl (Procedural Language/Perl) is a procedural language supported by the PostgreSQL RDBMS.
PL/Perl, as an imperative programming language, allows more control than the relational algebra of SQL.
Programs created in the PL/Perl language are called functions and can use most of the features that the Perl programming language provides, including common flow control structures and syntax that has incorporated regular expressions directly.
These functions can be evaluated as part of a SQL statement, or in response to a trigger or rule.
The design goals of PL/Perl were to create a loadable procedural language that:
PL/Perl is one of many "PL" languages available for PostgreSQL
PL/pgSQL
PL/Java, 
plPHP, 
PL/Python, 
PL/R, 
PL/Ruby, 
PL/sh, 
and PL/Tcl.