in reply to Getting files matching pattern (i.e. *.html)
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.
% perl -pi -e 's/foo/bar/' `find -name '*.html'`This simple substitution method could be turned into a shell script to reduce user error.
|
|---|