command line input argv

Discussion in 'Perl Misc' started by pop, May 15, 2006.

  1. pop

    pop Guest

    Hi folks,

    I have a certain output that I display on the terminal at the command
    line and the user should make the choice and I send that output to
    another perl file or throw an error and await output again
    ex

    1. file _one
    2. file_two
    pleae enter your choice : #@$$
    Invalid entry
    Please enter your choice : 1
    <OUTPUT>

    Iam trying to figure out the part from capturing the input and waiting
    on the terminal for him to hit any choice. Can you guys give me a
    pointer on what function is used here to wait. I know I can use argv to
    capture the output.

    How can I print the line "Please enter the choice " and wait for him
    to enter any choice.

    cheers
    pop
    pop, May 15, 2006
    #1
    1. Advertising

  2. pop wrote:
    > I have a certain output that I display on the terminal at the command
    > line and the user should make the choice and I send that output to
    > another perl file or throw an error and await output again
    > ex
    >
    > 1. file _one
    > 2. file_two
    > pleae enter your choice : #@$$
    > Invalid entry
    > Please enter your choice : 1
    > <OUTPUT>
    >
    > Iam trying to figure out the part from capturing the input and waiting
    > on the terminal for him to hit any choice. Can you guys give me a
    > pointer on what function is used here to wait. I know I can use argv to
    > capture the output.
    >
    > How can I print the line "Please enter the choice " and wait for him
    > to enter any choice.


    print 'Please enter your choice: ';
    chomp( my $input = <STDIN> );

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
    Gunnar Hjalmarsson, May 15, 2006
    #2
    1. Advertising

  3. pop wrote:
    > [...]
    > Iam trying to figure out the part from capturing the input and waiting
    > on the terminal for him to hit any choice. [...]


    my $input = <>;
    print $input . "\n";
    Sumo Wrestler (or just ate too much), May 15, 2006
    #3
  4. pop

    pop Guest

    Thanks guys.

    pop.
    pop, May 15, 2006
    #4
    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. Bret

    char **argv vs. char* argv[]

    Bret, Aug 31, 2003, in forum: C Programming
    Replies:
    21
    Views:
    4,584
    Richard Heathfield
    Sep 3, 2003
  2. David
    Replies:
    10
    Views:
    5,951
    Richard Heathfield
    Sep 15, 2003
  3. Hal Styli
    Replies:
    14
    Views:
    1,629
    Old Wolf
    Jan 20, 2004
  4. =?ISO-8859-1?Q?Thomas_N=FCcker?=

    sys.argv[0] - 'module' object has no attribute 'argv'

    =?ISO-8859-1?Q?Thomas_N=FCcker?=, Jun 30, 2003, in forum: Python
    Replies:
    0
    Views:
    901
    =?ISO-8859-1?Q?Thomas_N=FCcker?=
    Jun 30, 2003
  5. jab3

    char **argv & char *argv[]

    jab3, Dec 4, 2004, in forum: C Programming
    Replies:
    5
    Views:
    665
    Chris Torek
    Dec 8, 2004
Loading...

Share This Page