Using hooks -- simple please
To use a hook, you can:


Write a CiviCRM extension.  This is the preferred method.
Write a Drupal module.
Write a Joomla or Wordpress plugin.


The easiest way to write a CiviCRM extension is to install civix and run civix generate:module org.myorg.myextension.  Then you can edit myextension.php and paste in that code.

However, as that page says - this presumes that you have a basic knowledge of PHP, Unix, and object-oriented programming.  If that's not a skill you're going to learn today, and you want to cheat a little - take an existing extension and hack it!  Download an existing function, preferably one that does very little, and modify it to your needs.  I just uploaded an extension to Github that fits this need exactly here.