############################################ # VARIABLES ############################################ .... # array scotching sms which was readed my @msg2 = (); .......... ############################################ # START EXECUTION ############################################ answer_sms(); ########################################### # answer_sms() ########################################### sub answer_sms { #Build gsm object $gsm = new Device::Gsm(port=>'/dev/cuaU0'); # read SMS of Sim card @msg = $gsm->messages('SM'); # get the number of sms in the card $taille = @msg; # read the old sms in my sim card proc_read_card(); # creat array for stoching nmbr of sms in the card @tab=($taille); print "\nWAITING FOR NEW SMS.......\n"; while(1) { my $newtime = (time+50); @msg2 =$gsm->messages('SM'); $taille2 = @msg2; push(@tab,$taille2); if($tab[-1] != $tab[-2]) { # get the number of the last sender # following the LINE 94# my $dernier_num = $msg2[$#msg2]->sender(); ................ $gsm->send_sms(recipient=>$dernier_num,content=>"Error" ); ............. } }