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

Re^2: to copy certain content in file & repeat it .

by harshmane (Initiate)
on Jun 30, 2011 at 09:16 UTC ( #912128=note: print w/replies, xml ) Need Help??


in reply to Re: to copy certain content in file & repeat it .
in thread to copy certain content in file & repeat it .

#! /usr/bin/perl use warnings; open (FF,"src.txt"); # fro where i have to read. open (FF1,">dest.txt"); # while (<FF>) { $lin=$_; print FF1 $lin; if (/input/) # input i a word after dat all paragraph shud be copied + till other wor is not encounterd diz word is #repeated is present tw +ice in given file {$i=0 while(<FF>) { @arr =$_; print FF1 @arr; $i++; exit if ($arr =~/term/); } } } while (<FF>) { for ($j=0;$j<$i;$j++) { print FF1 @arr[$j]; } }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://912128]
help
Chatterbox?
[marto]: sounds fun, the opposite of my weekend :P
[Corion]: marto: You wrote Perl? Or did you have to work (and wrote Perl)?
[marto]: the fun part, I had no fun this weekend, very stressful :)
[Corion]: But I feel an introductory talk gestating, working title "Reading CPAN" - how to read module documentation, how to judge a module, how to read the module tests/examples
[Corion]: marto: Ouch :-/ The kids are making trouble?
[Corion]: Meh - food becons, and colleagues are staring at me, talk to you later, sorry!

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2017-08-21 09:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Who is your favorite scientist and why?



























    Results (319 votes). Check out past polls.

    Notices?