Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: change forward slash to backslash

by vek (Prior)
on Nov 20, 2005 at 15:44 UTC ( #510247=note: print w/replies, xml ) Need Help??

in reply to change forward slash to backslash

If you plan on using that directory as part of a filename, you could always give File::Spec a try. Not only will it do what you want by converting C:/windows to C:\windows, it helps you write portable code.

use File::Spec; use strict; use warnings; my $dir = 'c:/temp'; my $file = 'tempfile'; my $path = File::Spec->catfile($dir, $file); print $path, "\n";
Which will output C:\temp\tempfile

-- vek --

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2016-10-26 18:44 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (345 votes). Check out past polls.