Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

how to merge this two array and update my files?

by virudinesh (Acolyte)
on May 14, 2013 at 06:56 UTC ( #1033426=perlquestion: print w/replies, xml ) Need Help??
virudinesh has asked for the wisdom of the Perl Monks concerning the following question:

my input files: chapter2.htmal ->it contains <?xml version="1.0" encoding="UTF-8"?> <body>

<img src="images/fig6.1jpg" alt=""/>

regression figure 6.1 also provides a kind of figure 6.1 pressure for families figure 7 perceiving regressive decisions and behavior as figure 6

regression figure 6.1 ------------------------------------------------------------ chapter 20.html ->this file conatains

In this chapter we will figure 20.2 concentrate on general solutions of PDEs in terms of arbitrary functions and the particular solutions that may be derived from them in the presence of boundary conditions. We also discuss the existence and uniqueness of the solutions to PDEs under given boundary conditions.

In the next chapter the methods most commonly used in practice for obtaining solutions to PDEs subject to given boundary conditions will be considered. These methods include the separation of variables, integral transforms and Green’s functions. This division of material is rather arbitrary and has been made only to emphasise the general usefulness of the latter methods. In particular, it will be readily apparent that some of the results of the present chapter are in fact solutions in the form of separated variables, but arrived at by a different approach.

<img src="images/img_677_fig20.1.jpg" alt="image"/>

As in other chapters we will focus our attention on the equations that arise most often in physical situations. We will restrict our discussion, therefore, to linear PDEs, i.e. those of first degree in the dependent variable. Furthermore, we will discuss primarily second-order equations. The solution of first-order PDEs will necessarily be involved in treating these, and some of the methods discussed can be extended without difficulty to third- and higher-order equations. We shall also see that many ideas developed for ordinary differential equations (ODEs) can be carried over directly into the study of PDEs.

In this chapter we will concentrate on general s

<img src="images/img_677_fig20.2.jpg" alt="image"/>


#!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(<FH>) { 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=<FH>; 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])+|fi +g[ ][0-9]+|fig[0-9]+|fig([0-9])+-([0-9])+/i) { $a= $'; $match_key=$&; #print " --match : -- $match_key \n "; $front=$`; if($_=~m/<p class="fig-img"|<p class="image"/i) { $match_key1=$'; $replace_line=$&."id=$match_key".$'; #print " $replace_line \n"; $rep1=$rep1.$replace_line; #print" ------- $replace_line \n"; if($match_key1=~m/fig( |[a-z])*(\d+)(\.(\d+))?/i) { $key="figure ".$2.'.'.$4; a(); } } #push(@file2,$a); } $rep1=$rep1.$a; # print " .... $rep1 \n"; push(@figer,$rep1); $rep1=""; } close(FH); } sub a() { foreach(@file_list) { $ff=$_; my($filename, $directories, $suffix) = fileparse($f); $ka=$filename; open(FH,"<", "$ff")or die "unable to open toc file $!"; @content1=<FH>; foreach(@content1) { c(); # print"11111111111 $rep \n"; } close(FH); } # push(@figer1); print "@figer1 \n"; } sub c() { $b=$_; if($b=~m/<p class="fig-img">|<p class="image">|<p class="capt +ion">|<p class="fig-caption">/i) { push(@file1,$b); } else { while($b=~m/$key/i) { $b=$'; $match_key3=$&; $before3=$`; $replace_1=$before3.'<a href='.$ka.'"'.$match_key.'"'.'> +'.$match_key3.'</a>'; $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

Replies are listed 'Best First'.
Re: how to merge this two array and update my files?
by marto (Bishop) on May 14, 2013 at 08:25 UTC

    If you run this you'll be told about errors you need to fix. Add use strict; remove the duplicate #! lines. This isn't a code writing service. If you want to learn Perl read the advice and links provided in response to your previous questions, including:

    If you don't want to learn perl I suggest a change of hobby/career.

Re: how to merge this two array and update my files?
by Anonymous Monk on May 14, 2013 at 07:22 UTC
    Its simple, hire a programmer.
Re: how to merge this two array and update my files?
by space_monk (Chaplain) on May 14, 2013 at 21:29 UTC

    Why does the code have 3 '#!C:/Perl/bin/perl.exe -w' lines? Trying to start Perl 3 times won't make it 3 times as fast! ;-P

    If you spot any bugs in my solutions, it's because I've deliberately left them in as an exercise for the reader! :-)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1033426]
Approved by herveus
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2017-10-18 12:05 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (244 votes). Check out past polls.