Trying to modify Main menu by testing $vars['heading']['text'] == 'Main menu', I'm trying to modify the code for the main menu only. below is my sorry code, which is not working.
it attempts to see if $variables['heading']['text'] equal 'Main menu'

function myTheme_link($variables) {
if($variables['heading']['text'] == 'Main menu') {
//put my mods here
} else {
  return '&lt;a href="' . check_plain(url($variables['path'],     $variables['options'])) . '"' . drupal_attributes($variables['options']    ['attributes']) . '&gt;' . ($variables['options']['html'] ? $variables['text'] :     check_plain($variables['text'])) . '&lt;/a&gt;';
}
}


this must be close, no? i would greatly appreciate if someone could advise
You can do it by using this code in template.php file of your active theme.

function mytheme_links__system_main_menu($variables) {
  $html = "&lt;div class='myclass'&gt;";
  $html .= "  &lt;ul&gt;";  
  foreach ($variables['links'] as $link) {
    $html .= "&lt;li&gt;".l($link['title'], $link['path'], $link)."&lt;/li&gt;";
  }
  $html .= "  &lt;/ul&gt;";
  $html .= "&lt;/div&gt;";

  return $html;
} 


or you can add customization in $variables also if we have do minor customization to do.
Here replace mytheme with name of your theme.
Clear you cache after using this code.

Hope it will help you!