in reply to Spaces in file names passed as arguments

If you add a line like print "Doing $_\n"; at the beginning of your for loop, you'll see that @ARGV is getting your argument already broken up into 3 parts. In other words, it's not a problem with your script, but with the shell parsing the arguments before they're passed to your script. One solution would be to escape the spaces within your quotes: titulize.pl "test\ spacefull\ name.avi".

Edit: Never mind this answer; toolic caught the real problem, the brackets around @ARGV. Hard to tell what that's actually doing, but ordinarily just quoting your arguments should get them into @ARGV properly.

Replies are listed 'Best First'.
Re^2: Spaces in file names passed as arguments
by Anonymous Monk on Sep 08, 2011 at 18:04 UTC

    Hard to tell what that's actually doing

    Not at all :)

    $ perl -MO=Deparse -le " for(<@ARGV>){print} " BEGIN { $/ = "\n"; $\ = "\n"; } use File::Glob (); foreach $_ (glob(join $", @ARGV)) { print $_; } -e syntax OK
    glob