On 6/3/07, Mike Lesser <[EMAIL PROTECTED]> wrote:
I use the module Getopt::Long to read arguments, one of which is a file path that may have spaces. The path string that is returned from Getopt has spaces without escape chars. The string seems to be fine for Perl use, but not so great for other things, such as the Shell module, which can't handle the spaces.
So, the problem isn't that Getopt::Long is giving you the correct file name, which happens to contain spaces. The problem is that you're passing a string containing shell metacharacters (spaces) to the shell. Yes? I fear that you're using the Shell module for more than it was intended to do, perhaps because you don't know about system(). One easy solution may be to give a list of arguments to system(). The first is the name of the program you're trying to run, the rest of the list are the command-line arguments to give it. You don't need to escape anything, because the strings are passed as-is. # use the system's chmod command on a list of filenames system "chmod", "u+w", @filenames; Hope this helps! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/