I'm working on my very first curses app, and now that I've decided to let the user move the cursor around with the arrow keys I've run into my first real roadblock.
I've got a main loop that runs like so:
while ( my $in = $main->getch () ) {
# Do stuff here.
}
Inside this loop, I'm trying to see if the user presses one of the arrow keys, and from the ncurses tutorial I've been reading (which is for C), it looks like the way to do it is either
$in == KEY_LEFT or
$in eq KEY_LEFT in the case of the left arrow key. However, this gracefully completely fails to work.
From my efforts at debugging, it looks like the program reads three characters each time one of the arrow keys is pressed.
Does anyone know how I can get this working the way I want to?