#!perl -w use strict; print "Enter CTRL-C to end input\n"; my $lines = get_lines(); print "Enter CTRL-C to exit\n"; while ( 1 ) { local($") = ', '; print "You entered: @$lines\n"; sleep(1); } sub get_lines { use threads; local($SIG{INT}) = 'IGNORE'; $lines = threads->create( sub{ my @rv = ; chomp @rv; return \@rv } )->join(); }