Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Spaces in file names passed as arguments

by aaron_baugher (Curate)
on Sep 08, 2011 at 16:00 UTC ( [id://924848]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://924848]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-03-28 13:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found