Almost always the answer to the sort of probelm involves line end sequence characters. « is character 171 (0xab) and it is not at all clear to me how the normal line end characters (\n and \r) could mutate into that unless something is translating all unprintable characters into that. Assuming that to be the case:

Perl is expecting the line seperator character sequence to be a new line character ("\n"). If the application you are running is generating output for Windows or a Mac, or for various other purposes (network output for example), the line end may be a sequence of "\r\n" (for Windows and network) or "\r" for a Mac. I think it most likely that the odd character you are seeing is a "\r" which you could handle as:

$tm =~ s/[L\r]//;

However I doubt that you really want an 'L' in there so most likely what you want is:

$tm =~ s/\r//;

DWIM is Perl's answer to Gödel

In reply to Re: Regex for replacing hidden character: « and L by GrandFather
in thread Regex for replacing hidden character: « and L by neversaint

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.