for(;;){
my $result=$PortObj->input;
if($result =~ m/foo/){
$count++;
my $query="INSERT INTO logs(cl_date, cl_dialled) values(now(),'$count')";
my $clsth=&db_query($query);
}
}
####
bash-2.05b# echo "foo" >> /dev/ttyS0
bash-2.05b# echo "foo" >> /dev/ttyS0
bash-2.05b# echo "foo" >> /dev/ttyS0
####
root@alexis:/export/serial/# stty -a < /dev/ttyS0
speed 9600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = ; eol2 = ; start = ^Q; stop = ^S; susp = ^Z;
rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke