I need to debug this script. This is an urgent requirement

Type: use strict; very fast

--> Global symbol "$string" requires explicit package name at bugscri +pt.pl line 18. Execution of bugscript.pl aborted due to compilation errors.

Ok, we got one!

Can't see the strings "newname" or "oldname" in your script. Can we have an example of the matching line?

(...few minutes later...)

Ok, i see... Try to be as clear as you can.

my $filename = $ARGV[0]; my $oldname = $ARVG[2]; my $newname = $ARGV[1];

oldname = 2, newname = 1... you want to change 2 by 1. Could I suggest to replace 1 by 2 instead and avoid unnecessary obfuscation?

my $string =~ s/^module.*?$oldname.*?([\\(;])/module $newname$1/sg;

Mmmh, I'm not very comfortable with the idea of to use ";" or "(" as last character of a filename...


In reply to Re: Bug in script, regex help req extreme urgent by pvaldes
in thread Bug in script, regex help req extreme urgent by sid.verycool

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.