function for gsm commands

Hi , i do a project with sensor and gsm shield. I have a code which make a call and send data to myDatabase. I need a function to put in the code.

When a sensor "on" call the function.

I did not like so much code in loop function.

Is it feasible?

Thanks

void loop()
{
  if (digitalRead(sensorInput) == HIGH)
    {
      someFunction();
    }
}

void someFunction()
  {
    //do whatever
  }
}