The problem still remains. Look at the small program below.
The result is this:       DirectionsNitprogrsourcsql
                                DirectionsNitprogrsourcsql

And I would like it to be this:    \Directions\unit\progr\sourcsql

.Directions.unit.progr.sourcsql

Notice that it doesn't print the backslashes and  it when the backslash is
followed by a "u", it transform in uppercase the next letter as it would do
a break page if it was followed by a "n".

The value given to the $reprt in the program below is fetched from a
database query and appears to be stored exactly like this in the table

##########################################################
#!/usr/bin/perl
my ($reprt);
$reprt= "\Directions\unit\progr\sourcsql";

print $reprt."\n";

# $reprt =~ s/\\/\\\\/g;
$reprt =~ s/[\\]/\./g;

print $reprt."\n";

##########################################################


"Todd Wade" <[EMAIL PROTECTED]> a écrit dans le message de news:
[EMAIL PROTECTED]
>
> "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