#!/usr/bin/perl use strict; use warnings; use threads; use Thread::Suspend; $|=1; my $TERM = 0; $SIG{'INT'} = $SIG{'TERM'} = sub { $TERM = 1; }; print "To terminate program, hit ctrl-^C\n"; sub start_thread { my @args = @_; print(join(' ', @args,)); } my $thr = threads->create(\&start_thread); $thr->join(); $thr->suspend(); $thr->yield(); sleep (1) until ($TERM); print ("\e[2K\e[?25h\n"); #to restore proper cursor behavior