You are correct in that you will either have to use quotes to import the literal file specification "*.html". You could also let the shell do it for you, but pass this list in using without using '-i', and use your program as "replacer *.html" with the files being specified explicitly.

You can always expand your -i parameter:
my @opt_i = glob($opt_i);
This is not recursive, though. For that, you might have to use something like File::Find which means converting your shell-style glob into a regex, or for a quick and dirty hack, just use the output of find.
my @opt_i = map { chomp; $_ } `find $opt_i`;
Which will work as well. Note that this is kind of crazy, because you are using tainted input which is being passed to the command line. This can be dangerous if the program is being run with privileges that the user shouldn't have, such as via a Web page, or a "suid" script.

As an alternative, you could just use Perl to do your dirty work for you.
% perl -pi -e 's/foo/bar/' `find -name '*.html'`
This simple substitution method could be turned into a shell script to reduce user error.

In reply to Re: Getting files matching pattern (i.e. *.html) by tadman
in thread Getting files matching pattern (i.e. *.html) by schnarff

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.