in reply to Re: array problem
in thread array problem

i typed wrong, i have closing operators but i am not sure if qx returns separate items for output! I relly don't think so! Do you know any quotelike operators that returns separate items for output! Thank you for your time!!

Replies are listed 'Best First'.
Re: Re: Re: array problem
by bart (Canon) on Sep 12, 2003 at 16:43 UTC
    Check out perlop, where it says about qx() (or backticks, ``, which most of us will be more familiar with):
    In list context, returns a list of lines (however you've defined lines with $/ or $INPUT_RECORD_SEPARATOR), or an empty list if the command failed.
    By default, that is a newline. So the list returned contains one item per line. The question remains: does your command line return a multiline result? I'm not familiar with what you try to do, so I can't tell.

    You can easily test in two ways:

    • @a = qx(COMMANDLINE); print scalar @a;
    • $a = qx(COMMANDLINE); print "<plaintext>$a";
    The former will print the number of items, the latter will make the browser display the text as plaintext, line wrapping an all.

    I just hope that yo ucan tweak your command line so that you can get separate lines for the returned items. If not, you can set $/ to whatever string separates the data items.