in reply to Using stdin only if there is input on it, but skipping it if there is no data

It seems that Fletch has provided you with a workaround. If you are interested in a more formal solution, you will find that it is probably system dependent. Start by reading getc and Term::Key.

UPDATE: I found the link to Term::ReadKey in the documentation of getc. It appears to have useful info. Sorry for the error in posting the link.

Bill
  • Comment on Re: Using stdin only if there is input on it, but skipping it if there is no data

Replies are listed 'Best First'.
Re^2: Using stdin only if there is input on it, but skipping it if there is no data
by mldvx4 (Hermit) on Nov 18, 2020 at 16:34 UTC

    Thanks. The link for Term::Key seems dead, but Term::TermKey is present. However, the CPAN page says that it is deprecated. Is there any other option for more formal solutions, besides getc?

      I'm not aware of any deprecation of Term::ReadKey so perhaps that might also be an option for you.


      🦛