Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: Errors in File::Recurse()?

by lolindrath (Scribe)
on Nov 10, 2000 at 02:13 UTC ( #40832=note: print w/ replies, xml ) Need Help??

in reply to Errors in File::Recurse()?

Windows paths in perl must look like this:


Those crazy DOS people.


Comment on Re: Errors in File::Recurse()?
Download Code
RE: Re: Errors in File::Recurse()?
by myocom (Deacon) on Nov 10, 2000 at 02:16 UTC
    Actually, that's not-so-much true. Within Perl (and really, for many Win32 functions), 'c:/folder' is perfectly valid.
RE: Re: Errors in File::Recurse()?
by Fastolfe (Vicar) on Nov 10, 2000 at 02:20 UTC
    Or 'c:\folder\folder'. You only need to escape the back-slashes when you use them together (so you can still escape '): '\\\\server\share\dir\jack\'s file'
      Hehe...well, the unexpected behavior in this situation is that if you use a function that evaluates the path string and the first letter after a single backslash is an 'n' or some other command (e.g.: \n, etc.) then it evals that command and craps out your function. Forwardslash works fine on Win2k, dunno about other M$ products.

        Any function that "evalutates the path string" is pretty much broken in my book. Perhaps you could give us an example here. I suspect you might be confused as to how Perl deals with strings.

        Also, one other case where you need to double your backslash inside of single quotes (or the q{} operator) is if you want a backslash at the end of the string. I find not doubling your backslashes inside of single quotes to be a bad habit that leads to forgetting to double them in the cases when you need to (which leads to strange errors that can be very hard and time-consuming to find) and so I say always double your backslashes in single quotes.

        BTW, it would have been much nicer if single quotes had been defined so that you double the delimiter to include it in the string (like 'should''ve'). Then backslash would have no special meaning inside single quotes (unless you used it as the delimiter like q\this\). But it is too late to change that now.

                - tye (but my friends call me "Tye")

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2014-09-20 23:47 GMT
Find Nodes?
    Voting Booth?

    How do you remember the number of days in each month?

    Results (164 votes), past polls