#!perl -w use strict; use threads; my @lines; print "Enter CTRL-C to end input\n"; $SIG{INT} = 'IGNORE'; # making this local() causes ctrl-C to kill the script @lines = ; threads->create( sub{} )->join(); $SIG{INT} = 'DEFAULT'; # putting this after thread creation makes everything happy chomp @lines; # kill newlines from STDIN entries print "Enter CTRL-C to exit\n"; local($") = ', '; while ( 1 ) { print "You entered: @lines\n"; sleep(1); }