nagalenoj has asked for the wisdom of the Perl Monks concerning the following question:
When I use the perl package Term::Screen and gets some input from user, newline's ASCII value is returning as 13. And, when I comment the use of Term::Screen, the ASCII value is returning as 10.
How does it got change?
use Term::ReadKey; # use Term::Screen; # my $scr; # $scr = Term::Screen->new; # unless ($scr) { die "Couldn't create object for Term::Screen\n"; } # $scr->clrscr; # Get the user name and password my ($user, $key); print "\nYour name: "; ReadMode 4; # Turn off controls keys while (1) { $key = ReadKey(0); if (ord($key) == 13) { print "Newline got at 13"; last; } if (ord($key) == 10) { print "Newline got at 10"; last; } print $key, "--", ord($key),"\n"; } print $key, "--", ord($key),"\n"; ReadMode 0; # Reset tty mode before exiting
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Ascii value is different
by almut (Canon) on Apr 19, 2010 at 12:56 UTC | |
Re: Ascii value is different
by cdarke (Prior) on Apr 19, 2010 at 13:13 UTC |
Back to
Seekers of Perl Wisdom