Similar to the previous reply (but slightly different):
# assume that input from readline is stored in $_ my ( $command, @topic ) = split; my $filename = pop @topic; my $topic = join ' ', @topic;
This (like the earlier reply) takes it for granted that your complex command strings are limited to a single "command_word" followed by one "multiword_arg" followed by one "filename". At the very least, you are limited to not more than one multiword_arg per input line, with no variability (no optionality) in the presence of single-word args before and/or after the one multiword_arg.

If you think you need to support command lines that won't conform to those restrictions, there are probably a few tricks for defining a suitable command line syntax that will allow the flexibility you need (e.g. using special characters or "option flags" to delimit multiword_args). Or you might consider using and handling quotes around the multiword_args (as any standard unix shell would do).


In reply to Re: readline and multi-word commands by graff
in thread readline and multi-word commands by nick

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.