How to append to menu items selectively

This is another case where a pure-CSS definition will work. For example:

#main_nav_left li:after {
    content: ' | ';
}
#main_nav_left li:last-child:after {
    content: '';
}