Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2014-08-30 16:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (293 votes), past polls