"Beau E. Cox" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi -
>
> > -----Original Message-----
> > From: Guy P [mailto:[EMAIL PROTECTED]
> > Sent: Monday, March 03, 2003 9:10 AM
> > To: [EMAIL PROTECTED]
> > Subject: Backslash in a string
> >
> >
> > Hello,
> > My Perl program execute a query that bring back into a variable a
Windows
> > paths initially stored in a database. I have got problems to manage the
> > backslash.
> >
> > Example:
> >
> > Here's what is stored in the database  -->
> > \Directions\unit\progr\sourcsql
> > I would like to get it in a variable thus I could use the Perl print
> > function and have the same printed on the screen.
> >
> > Thank you!
> >
>
> Escape the esacpe character; if $var holds your
> path, do:
>
>  $var =~ s/\\/\\\\/g;
>
> This replaces \ with \\ which will then print as \.
>
> Pretty messy, yeah?
>

You can use a forward slash for directory seperators inside perl and it will
know which file you are talking about:

open( FH, 'c:/path/to/file.ext' ) or die( "open failed: $!" );

Todd W.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to