Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: modify the include files depending up on instructions in it

by perlsen (Chaplain)
on Mar 17, 2005 at 08:56 UTC ( [id://440308]=note: print w/replies, xml ) Need Help??


in reply to modify the include files depending up on instructions in it

Hi just try this below coding

input: ********* #include "../comm.cfg" #include "../ext.frg" #include "../mem.cmd" $str=qq{\#ifdef SYM \#include "$INCLUDE_DIR/ext.frg" \#else \#include "../include/ext.frg" \#endif \#ifdef SYM \#include "$INCLUDE_DIR/mem.cmd" \#else \#include "../include/mem.cmd" \#endif}; undef $/; open(READ, "< input.pl") ; $string = <READ>; close(READ); $string =~ s#(\#include.+?\n)#${str}\n$1#gsi; open(OUT, "> output.pl") ; print OUT $string; #output: #******** #ifdef SYM #include "/ext.frg" #else #include "../include/ext.frg" #endif #ifdef SYM #include "/mem.cmd" #else #include "../include/mem.cmd" #endif #include "../comm.cfg" #ifdef SYM #include "/ext.frg" #else #include "../include/ext.frg" #endif #ifdef SYM #include "/mem.cmd" #else #include "../include/mem.cmd" #endif #include "../ext.frg" #ifdef SYM #include "/ext.frg" #else #include "../include/ext.frg" #endif #ifdef SYM #include "/mem.cmd" #else #include "../include/mem.cmd" #endif #include "../mem.cmd"

Log In?
Username:
Password:

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

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

    No recent polls found