I was working on something, and then this 'small trick' made me stuck for couple of minutes. I just don't want everyone to waste this couple of minutes, which is so precious, so I come to share with you.

The problem is with Data::Dumper, it appears to be a little bit too smart. Because my program is relatively big, and what I was modifing was hundreds lines away from Dumper, so at first I even didn't think that, the trouble was caused by Dumper, until I suddenly started to suspect ... Now I simplify the trick and share with you:
use Data::Dumper; $hash = {1 => "(\\d+)"}; #the value is (\d+) print "result from print Dumper:\n"; print Dumper($hash); #which prints (\\d+), this really confused me print "\n"; print "actual value stored:\n"; print $hash->{1};
I hope Dumper can simply tell me the truth, not to play smart, and confuse me. Although that \\ makes sense to me now, but what is the benefit to display in this way?

Now, is there an option in Dumper, that I can turn this off.

In reply to Data::Dumper style by pg

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.