#!perl use strict; use Win32::SerialPort; my $port=shift || "COM9"; print "Connecting to $port .... "; our $PortObj = new Win32::SerialPort($port); unless(ref $PortObj){ print "Unable to connect to $port\n"; exit; } print "Connected!\n"; print "Press to disconnect"; my $cmd=; $PortObj->close(); exit(0);