I think you need to explore the wonders of Term::ReadKey,
which has lots of neat tricks but one of them is the function
ReadKey.
And I quote from perldoc Term::ReadKey ( slightly reformatted
to make it read easier )
ReadKey MODE [, Filehandle]
Takes an integer argument, which can currently be
one of the following values:
0 Perform a normal read using getc
-1 Perform a non-blocked read
>0 Perform a timed read
(If the filehandle is not supplied, it will
default to STDIN.) If there is nothing waiting in
the buffer during a non-blocked read, then undef
will be returned. Note that if the OS does not
provide any known mechanism for non-blocking
reads, then a `ReadKey -1' can die with a fatal
error. This will hopefully not be common.
You can play meaner games with select() if you cannot get
this module installed.
mikfire
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|