Hi,

I'm frustrate because I cannot imagine which makes in my code fails next sentence (which works fine until some points which I don't know):

if ($r =~ //) { xxx }

I was debugging my issue and find this, maybe there is relation:

Consider next simple program:

#!/usr/bin/perl -w use CGI qw(:standard); my $q=CGI->new ;
And then execute perl -d file or perl -e perl -d -e 'use CGI qw(:standard); $q=CGI->new' Then in the debugger:
DB<1> w print "hola" if ("r" =~ //); DB<2> holac Watchpoint 0: print "hola" if ("r" =~ //); changed: old value: '1' new value: '' CGI::_compile(/usr/share/perl/5.12/CGI.pm:867): 867: ($pack,$func_name) = ($1,$2); DB<2> holaholaholaholaholaholaholaholaholaholaholaholaholaholaholaho +laholaholaholaholaholaholaholaholaholaholaholaholaholaholaholaholahol +aholaholaholaholaholaholaholaholahola DB<2> p print "hola" if ("r" =~ //); DB<3>

So, why "r" =~ // changes her semantics? (note DB<2> response and remember that it happens too in some moment inside my code (which is larger and I cannot post fully here))

Please see that "r" =~ // come from "$r" =~ /$r2/ in my real program. And too if I change $r2 to "." if it is empty my program works fine.

So, do you think I should report it as an CGI.pm bug or do you have any tip for me?

Thank you very much monks!

PD: I don't know if this go better to "Meditations" or it is ok in Seekers section.


In reply to Is this a bug ? by i5513

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.