From Lucinda Bulloch via the scripting forum:

this is a basic one but shows you how it works

list datalist = []; //the lines of the card will be placed here

key conquery; // the key that the server gives you data

integer dataend = 0; //line counter

string notecardname = "name of card here"; //name of card to be read

default
{
  on_rez(integer start_param)
   {
    llResetScript(); //reset and clear memory on rez
   }
   
  state_entry()
   {
    conquery = llGetNotecardLine(notecardname ,dataend); //ask data server to get a line from the notecard
   }

dataserver(key query_id, string data)
  {
   if(query_id == conquery) //is the key the one i want
    {
     if (data != EOF) // has it reached the end of the file?
      {  
       datalist += data; //add the line to the data list
       dataend ++;       //increase to the next line
       conquery = llGetNotecardLine(notecardname,dataend); // get the next line
      }
     else
      {
        dataend =0;//all data got and ready to read another card
        // the card is loaded into list do something
        // if you have another card to load - then start a new key to load a diff list
        // or if using the same list, overwrite notecardname with the new name
        // and call conquery = llGetNotecardLine(notecardname,dataend) again          
            
      } 
    }
  } 
}