Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Bug in script, regex help req extreme urgent

by pvaldes (Chaplain)
on Mar 09, 2013 at 13:14 UTC ( #1022570=note: print w/ replies, xml ) Need Help??


in reply to Bug in script, regex help req extreme urgent

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...


Comment on Re: Bug in script, regex help req extreme urgent
Select or Download Code
Re^2: Bug in script, regex help req extreme urgent
by sid.verycool (Novice) on Mar 09, 2013 at 13:34 UTC
    Thanks for the reply pvaldis newname is NEW (module NEW) oldname is OLD (MODULE OLD)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1022570]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2014-09-18 05:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (108 votes), past polls