#!perl use strict; #http://search.cpan.org/~cosimo/Device-Modem-1.51/ use Device::Modem; my $port="COM9"; my $modem = new Device::Modem( port =>$port ); if($modem->connect( baudrate => 115200,databits=>8,parity=>'none',stopbits=>1 ) ) { print "connected!\n"; } else{ print "Error: Unable to connect with $port!.\n\t$!\n"; exit; } print "CMD->"; while(1){ my $cmd=; if($cmd=~/^(x|q|exit|quit)$/is){last;} $cmd =~s/[\r\n\t\s]+$//; $cmd =~s/^[\r\n\t\s]+//; $modem->atsend($cmd . Device::Modem::CR); print $modem->answer(); } #disconnect from the Modem $modem->disconnect(); print "\nDONE\n";