Programmatically moving menu links from one menu to another

Here's a little snippet to move a menu link from one menu to another. For example, let's move the Contact Us link from the Primary Links menu to the Secondary Links menu. All you really need to know is the internal name of the menu where you want it to move to.

$mlid = db_query("SELECT mlid FROM menu_links WHERE link_path = 'contact'")->fetchField();
$menu_link = menu_link_load($mlid);
$menu_link['menu_name'] = 'secondary-links';
menu_link_save($menu_link);