#!C:/Perl/bin/perl.exe -w #!C:/Perl/bin/perl.exe -w #!C:/Perl/bin/perl.exe -w use File::Spec::Functions; use File::Basename; open(FH,"<","path1.txt") or die "$!"; $i=1; $section_flag=1; while() { if($i==1){$path=$_;} $i++; } close(FH); opendir(DIR,$path) or die "can't open $path $!"; @files=readdir(DIR); close(DIR); foreach(@files) { if (-f $path . "/" . $_ ) { if($_=~m/.html|.xhtml/i) { $file=catfile($path,$_); if($_=~m/toc|content|tableof/i){$toc=$file;} else { push(@file_list,$file); } } } } #print @file_list; foreach( @file_list) { $f=$_; #print "$f\n"; open(FH,"<", "$f")or die "unable to open toc file $!"; @content=; foreach(@content) { $a=$_; while($a=~m /figer[ ]([0-9])+.([0-9])+|figer([0-9])+.([0-9])+|fig[ ][0-9]+.([0-9])+|fig[0-9]+.([0-9])+|figer[ ]([0-9])+|figer([0-9])+|fig[ ][0-9]+|fig[0-9]+|fig([0-9])+-([0-9])+/i) { $a= $'; $match_key=$&; #print " --match : -- $match_key \n "; $front=$`; if($_=~m/

; foreach(@content1) { c(); # print"11111111111 $rep \n"; } close(FH); } # push(@figer1); print "@figer1 \n"; } sub c() { $b=$_; if($b=~m/

|

|

|

/i) { push(@file1,$b); } else { while($b=~m/$key/i) { $b=$'; $match_key3=$&; $before3=$`; $replace_1=$before3.''.$match_key3.''; $rep=$rep.$replace_1; } push(@file1,$b); } $rep=$rep.$b; push(@figer1,$rep); $rep=""; } error ------ 1.its print separate separate function output ---------- 1.i need output is the @figer and @figer1 array is merge and update in once only 2.and update that .html file