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

Arrg,

Why developers put spaces in directory names I'll never know. It's created a condition where I can't figure out how to use open on the files successfully. If I ls from the shell on the value of interpolated variable (used quotes around the offending directory) it shows up fine, but it fails when I try to open it.

Humbly Submitted, coreolyn

Replies are listed 'Best First'.
Re: Spaces in Directory Name can't open file
by blakem (Monsignor) on Nov 21, 2001 at 05:05 UTC
    The 3 argument form of open should deal with the whitespace properly:
    open(FILE, '<', $filename);

    -Blake

Re: Spaces in Directory Name can't open file
by coreolyn (Parson) on Nov 21, 2001 at 05:07 UTC

    I new as soon as I ask the question I'd find an answer. Getting rid of the quotes worked surprisingly

    Update: I'm full of whatever.. after looking at what the code did it just dumped every thing in the wrong dir.. grrr going to try the open 3.

    Yet another update:
    Gotta love the camel I ran the $file =~ s#^(\s)#./$1#; against it and it solved the prob.

    coreolyn