STDIN Question

Discussion in 'Perl Misc' started by Hobbit HK, Dec 24, 2003.

  1. Hobbit HK

    Hobbit HK Guest

    I know that if I do:
    $line=<STDIN>;

    I'll read from STDIN until I'll press ENTER... My question is, how can
    I change it? I mean, can I do that if I'll press, for example, "c"
    it'll stop reading from STDIN? or, alternatively, can I do that it'll
    stop reading after 2 chars?
     
    Hobbit HK, Dec 24, 2003
    #1
    1. Advertising

  2. On 24 Dec 2003 09:45:50 -0800, Hobbit HK <> wrote:
    > I know that if I do:
    > $line=<STDIN>;
    >
    > I'll read from STDIN until I'll press ENTER... My question is, how can
    > I change it? I mean, can I do that if I'll press, for example, "c"
    > it'll stop reading from STDIN? or, alternatively, can I do that it'll
    > stop reading after 2 chars?


    perldoc -q key

    I do know if those methods display each key pressed or leave it up to you
    to echo them to the screen (with output buffering disabled and print
    without newline, although, you may need a newline after accepting last
    input).

    --
    David Efflandt - All spam ignored http://www.de-srv.com/
     
    David Efflandt, Dec 24, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Johnathan Doe

    peek at stdin, flush stdin

    Johnathan Doe, May 15, 2004, in forum: C Programming
    Replies:
    5
    Views:
    25,093
    Chatoyer
    May 17, 2013
  2. Charlie Zender

    Reading stdin once confuses second stdin read

    Charlie Zender, Jun 19, 2004, in forum: C Programming
    Replies:
    6
    Views:
    795
    Dan Pop
    Jun 21, 2004
  3. Ben
    Replies:
    2
    Views:
    1,356
    jacob navia
    Aug 29, 2009
  4. Terry Cooper
    Replies:
    7
    Views:
    428
    Janos Sebok
    Jun 9, 2009
  5. Stefano Sabatini
    Replies:
    6
    Views:
    298
    Stefano Sabatini
    Jul 29, 2007
Loading...

Share This Page