use warnings; use strict; use Fcntl; use IO::Handle; my $PORT = 'COM8'; sysopen(USB, $PORT, O_WRONLY | O_APPEND) or die "ERROR: $!\n"; USB->autoflush(1); print USB "hello world\n"; print USB "\x1BJ"; print USB "\x96"; print USB "\x1Bi\n"; close(USB);