Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
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 making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2015-07-07 06:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (87 votes), past polls