amoura has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re: output on the command line
by grinder (Bishop) on Jun 24, 2002 at 21:54 UTC
    You need to use a module that will take care of parsing the command line for you. Many exist, but as I see that you use the same option name more than once (e.g. --option), you will probably be better off using Getopt::Mixed.

    I wrote a tutorial on Parsing your script's command line, which may be of some assistance.


    print@_{sort keys %_},$/if%_=split//,'= & *a?b:e\f/h^h!j+n,o@o;r$s-t%t#u'
Re: output on the command line
by graff (Chancellor) on Jun 26, 2002 at 02:29 UTC
    You said: another program will generate a big list of output similar to this :...

    I'm wondering if this might be confusion about terminology. If you run that other program and it prints all this information on your screen, this is called the "standard out" (or "stdout") of that program. If you want your own perl script to read this in directly from that program (not from a disk file), then you simply place your perl script as part of a "pipeline" command, using the "vertical bar" character to join the output of that other command as the input to your perl script -- like this:

    other_program arg1 arg2 | your_perl_script
    The vertical bar is the common shell syntax for creating pipeline commands in both MS-DOS Prompt and Unix command line interfaces. Mac OS X, being based on Unix, would also provide this syntax in a command line interface window.

    This way your perl script simply needs to read STDIN, using the common idiom:

    while (<>) { # handle each line of data here }
    (I'm sorry if I have misunderstood your question.)