#!/usr/bin/perl use Term::ReadKey; use strict; my $c=""; do{$c.=ReadKey(0); last if $c=~/[\x0a]/} for 1..3; print "$c\n"; #### $# 12345 123