Gossamer Forum
Home : General : Perl Programming :

Using Perl to do serial port programming

Quote Reply
Using Perl to do serial port programming
Hi,

I would like to write a script to retrieve data from COM2. For example I am using a bar code scanner that will store store its data in memory to be accessed via COM2 l would ike to know where I can find information on completing such a script.

#!/usr/bin/perl -w
use strict;

open( PORT, "COM2" ) or die "Can't open COM2: $!";

while( <PORT> )
{
print"$_";
}

or using the read function to read from PORT2

$test = read(PORT,$buffer,255);


close( PORT );

Is the above code the right approach???

Thanks,
Mike...

Last edited by:

TheSafePick: Feb 7, 2004, 11:12 AM
Quote Reply
Re: [TheSafePick] Using Perl to do serial port programming In reply to
A search on search.cpan.org brings up quite a few matches, including Win32::SerialPort.

Philip
------------------
Limecat is not pleased.