What you think is happening is not.

Please give a short code example and give the actual contents of the file so we can track down what is really going on.

Here is a simple case for you to consider. Create a file called "raw_text" that looks like this:

hello world. This is a backslash: \ Here are 10 of them: \\\\\\\\\\
Now create a small Perl script that looks like this:
#! /usr/bin/perl -w use strict; my $file = "raw_text"; open(FILE, "< $file") or die "Cannot open '$file': $!"; my $contents = join '', <FILE>; print "HERE ARE THE CONTENTS OF $file:\n"; print $contents;
On my machine I get an output of:
HERE ARE THE CONTENTS OF raw_text: hello world. This is a backslash: \ Here are 10 of them: \\\\\\\\\\
As you see, Perl does not alter the text. You may be altering it, but Perl is going to be only doing what you said.

Now if your file starts off with something other than what you want, then you will need to figure out how to manipulate it into what you want. But nobody is going to be able to do that unless you have a more precise description of the change than just, "escaped". Escaped by what rules? Your talking about doubling backslashes tells me that it isn't using HTML escape codes. But there are a lot of other things that it could be and I am not going to guess.


In reply to Re (tilly) 3: UnEscaping text... by tilly
in thread UnEscaping text... by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.