Click = delete?

What im trying to get at is I want it so when i click, it will check if anything is there, and if there is, it will delete it. I don't want to have it so I have to attach the script to all the objects tho, just the camera i want the script in.. how can i do this?

Adapted from another answer:

function Update ()
{
   if ( Input.GetMouseButtonDown(0) )
   {
      var hit : RaycastHit;
      var ray : Ray = Camera.main.ScreenPointToRay (Input.mousePosition);
      if (Physics.Raycast (ray, hit, 100.0))
      {
         Destroy(hit.collider.gameObject);
      }
   }
}