saldoman has asked for the wisdom of the Perl Monks concerning the following question:

How can I get perl do deal with directories with spaces in the name of the directory. For instance I need to give my script an argument on which directory to work in, but if the name has a space in it I get a stat error message.

20050516 Edit by castaway: Changed title from 'windows directories'

  • Comment on Passing arguments with embeded spaces to perl scripts

Replies are listed 'Best First'.
Re: Passing arguments with embeded spaces to perl scripts
by sweetblood (Prior) on May 11, 2005 at 18:37 UTC
    You'll need to quote your arguments that contain spaces. This is a shell issue though, you'd have to do the same for any command ie:
    dir \"program files" or perl myscript.pl "some dir with spaces" "some other dir"
    HTH

    Sweetblood

Re: Passing arguments with embeded spaces to perl scripts
by Fletch (Bishop) on May 11, 2005 at 18:30 UTC

    Well, judging by your sample code . . . oh, never mind.

    Hint: Post the code and the exact error you're getting. Noting the OS would also be helpful. Having said that, I'm going to bet it's a shell quoting problem and not perl.