Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: add a line or string in complex perl file

by perlsen (Chaplain)
on Mar 16, 2005 at 10:11 UTC ( [id://439895]=note: print w/replies, xml ) Need Help??


in reply to add a line or string in complex perl file

Hi, just try this

input 1.pl; **************** open(CFG_READ, "< txt52_mm.org") || die "Couldn't open tmp config comm +and file for reading"; open(CFG, "> txt52_mm.cfg") || die "Couldn't open config file for writ +ing"; ... ... ... ... ... open(ASM_READ, "< t52${fl}a.org") || die "Couldn't open tmp"; open(ASM, "> t52${fl}a.asm") || die "Couldn't open file for writing "; ********************** ####### perl-coding start undef $/; open(READ, "< 1.pl") ; $str = <READ>; close(READ); $str =~s#"(> )(.+?)\.(cfg|asm)"#"$1\$execdir\/$2\.$3"#gsi; open(OUT, "> 2.pl") ; print OUT $str; ####### perl-coding end ********** output 2.pl ************** open(CFG_READ, "< txt52_mm.org") || die "Couldn't open tmp config comm +and file for reading"; open(CFG, "> $execdir/txt52_mm.cfg") || die "Couldn't open config file + for writing"; ... ... ... ... ... open(ASM_READ, "< t52${fl}a.org") || die "Couldn't open tmp"; open(ASM, "> $execdir/t52${fl}a.asm") || die "Couldn't open file for w +riting "; ******************

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-04-25 05:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found