Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

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 --

Comment on Re: change forward slash to backslash
Select or Download Code

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 browsing the Monastery: (5)
As of 2015-11-26 01:11 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (695 votes), past polls