First of all learn how to use a newsgroup

1) Use a proper subject
2) Post what you have tried
3) Do not expect a ready made solution... Even though a lot of good
people around would give u that , but u dont learn that way


What you could do is write a 
function file2str that reads a file and returns a string

Now do this

...
...

# Read the main file
$mainstr = file2str("mainfile");

# Substitue all the include lines
$mainstr=~s/^Include\s+\"(.*?)\"/file2str($1)/emg;

# Write back into file
open(OUT,">mainfile");
print OUT $mainstr;
close OUT

exit 0;

__END__


HTH 
Bye
Ram








On Wed, 2004-05-26 at 16:19, Girish N wrote:
> Hi All
> 
> I am stuck with this script which I need to finish today...
> 
>  
> 
> What I am supposed to do is 
> 
> 1)       parse a file and search for included files and insert those
> included files in the file.
> 
> Eg.
> 
> File1
> 
> Lkdfs
> 
> Sdfdsfds
> 
> Sdfsdf
> 
> Include "one.txt"
> 
> Sdfdsf
> 
> Sdfsdf
> 
> Werewr
> 
> Tytry
> 
>  
> 
> Where one.txt is
> 
> A
> 
> B
> 
> C
> 
> D
> 
> E
> 
> F
> 
>  
> 
> The expected result is
> 
>  
> 
> File2
> 
> Lkdfs
> 
> Sdfdsfds
> 
> Sdfsdf
> 
> A
> 
> B
> 
> C
> 
> D
> 
> E
> 
> F
> 
> Sdfdsf
> 
> Sdfsdf
> 
> Werewr
> 
> Tytry
> 
>  
> 
> 
> 
> Please help me with this ....
> 
> Thanks in advance
> 
> Girish
> 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to