in reply to Re: Translating Terminal Input Code from Bash to Perl
in thread Translating Bash to Perl

When I try this,
#!/usr/bin/perl use Term::ReadKey; use strict; my $c=""; do{$c.=ReadKey(0); last if $c=~/[\x0a]/} for 1..3; print "$c\n";
I still have to press ENTER key for the input to stop after the 3 characters. For example,
$# 12345 <ENTER KEY> 123

Replies are listed 'Best First'.
Re^3: Translating Terminal Input Code from Bash to Perl
by jakobi (Pilgrim) on Sep 30, 2009 at 22:18 UTC
    Hm. Try Almut's post's below: it shows an use of the ReadMode 4 setting. For more info, read perldoc -m Term::ReadKey.