Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Editing a Perl File

Status
Not open for further replies.

vincebrown

Technical User
Apr 25, 2005
19
GB
Hi. I've got a perl file that I want to edit using another perl script. I want the script to place '; #' when it sees '@ARGV[2])'. Can anybody help?
 
What are you having problems with? Did you try it yourself? Post the problem code and someone will probably be able to help you.
 
I'm having problems with the syntax, because it contains symbols that Perl recognises.
 
This example might help a bit:

Code:
while (<DATA>) {
    my ($find, $replace) = (quotemeta('$ARGV[2])'), '; #');
    s/$find/$replace/g;
    print;
}
__DATA__
No change here.
This will change $ARGV[2]) to something else
No change in this line either.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top