There are quite a few ways you can accomplish this with Linux + Postfix (other MTAs too) but since you have specific email addresses you want to process mail for as in this scenario the quickest way would be to have an alias[1] pipe to it to your script (language agnostic in this case). You can even use a .forward file, which might even work in the case of shared hosting.
A quick example of this for Perl is http://www.perlmonks.org/?node_id=1030830 (replace the perl script with any program)
Another way would be to setup a transport map that targets a hook that you setup in your master.cf file but it's probably best to find more tutorials online to understand everything that is taking place.
1. If your domain is using a virtual alias then point the virtual domain's recipient to the alias.