Afternoon,
you could use Term::ReadKey, for example:

        use Term::ReadKey;

        # if you hit ctrl-c you still want to return to 'normal'
        $SIG{INT} = sub{ReadMode('normal')};

        ReadMode('cbreak');

        # 'ord' returns the ASCII value of a character
        # and 27 is the value of escape
        if(ord(ReadKey(0)) == 27)
        {
            print "Escape";
        }
        else
        {
            print "Something else";
        }

        print " entered\n";

        ReadMode('normal');

You should make sure that the 'ReadMode' returns to normal at the end (hence the 
interrupt signal handler) otherwise you won't know what you're typing.

How you implement this depends on the context in which it's used (if it's a menu or a 
process running in the background, for example), but you won't have to hit return for 
this.

Cheers!

________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to