I'm not sure if I get the intent of your example... Did you mean to say you wanted a command line syntax like this:
makeupscript.pl -c *.txt -o outputfile.txt -l asdf.pl
In order for that to work, you have two options:

(1) You could put appropriate quotation marks around the '*.txt' (or "escape" the "*"), so that the shell will treat it as a literal string and pass it directly to the script, rather than trying to expand it to the set of matching file names. (In unix shells, you escape a chosen character by putting backslash in front of it: \*.txt). This way, you have to do a "glob" inside the script to get the set of matching file names.

(2) You could restructure the syntax, to something like this:

makeupscript.pl -o outputfile.txt -l asdf.pl *.txt
Note that this does not use "-c" to identify the "role" of the "*.txt" arg(s) -- "-o" still assigns a role to "outputfile.txt" and "-l" still identifies "asdf.pl" -- and by using either Getopt::Std or Getopt::Long, the relative ordering of these two options doesn't matter (update, to clarify, "-o arg" can preced or follow "-l arg") -- but all other arguments on the command line are assumed to be the list of *.txt files (update, to clarify: both "-o arg" and "-l arg" must precede all such args). The shell expands "*.txt" to the set of matching file names, and they all go into @ARGV (update: and are still in @ARGV after the Getopt work is done).

(Note that some (most?) shells have a limit on the amount of memory available for argument expansions on a command line. If there are many hundreds or thousands of files that would match, you might not be able to run the command this way.)


In reply to Re: How to do WildChars (*) on the command line for my script by graff
in thread How to do WildChars (*) on the command line for my script by EchoAngel

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.