#!/usr/bin/perl $| = 1; use strict; use warnings; system "stty -icanon -isig -echo min 1 time 0"; system "tput clear"; print "enter some text:\n"; processText(); sub processText { while ( my $char = STDIN->getc() ) { if (ord($char) == 3) { # Ctrl-C system "stty icanon echo isig"; exit; } # System call causes only a single character to print out, apparently can # be anything, eg `ls`. Get same behavior with shell exec using backticks. system "tput sc"; print($char); } } system "stty icanon echo isig";