#!/usr/bin/perl use strict; use warnings; our $log_fh; our $ob; our $PORT; my $thread1; our $BAUD; our$PARITY; our $DATA; our $STOP; our $received; my $thread2; sub SetThreads{ # in the version without Tk this helped to get rif of annoying on screen errors open($log_fh,"> tmp"); *STDERR = $log_fh; # THREAD 1: GUI $thread1 = threads->create(&TkWindow,$received); $thread1->detach(); # THREAD 2: receiving data from another device $thread2 = threads->create(&Receive,$PORT,$received); $thread1->detach(); } 1;