List Info

Thread: Help breaking up large text file.....




Help breaking up large text file.....
country flaguser name
United States
1969-12-31 18:00:00

Hello everyone, I have a large text file which I want to break up
and insert each chapter in an individual array. How can I do that...
this is what I have so far:
#__________________________________________________________

open(FILE1, "c:\perl\stories.txt") or die "Can't open stories.txt:
$!n";
while( <FILE1&gt; ) {

s/S*$//;
s/s*//;
s/^s*//;
chomp;
push myarray, $_ ;
}
close FILE1;
#__________________________________________________________

This algorithm allows me to add each line of the text file into the
Array 'myarray'

My file has 7 chapters and would like to assign each chapter into
one of seven arrays...meaning chapter 1 goes to mychapter1, chapter
2 goes to mychapter2...and so on....

Each chapter has the string 'CHAPTER' at the begining of a chapter.

Any help will be appreciated....thanks in advanced.

__._,_.___
.

__,_._,___
Re: Help breaking up large text file.....
country flaguser name
United States
2007-03-30 17:46:14

>>&gt;>> "paotrader" == paotrader < paolo%40snet.net">paolosnet.net&gt; writes:

paotrader> My file has 7 chapters and would like to assign each chapter into
paotrader> one of seven arrays...meaning chapter 1 goes to mychapter1, chapter
paotrader> 2 goes to mychapter2...and so on....

No, you don't. Really, you don't.

<http://perl.plover.com/varvarname.html&gt;

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<; merlyn%40stonehenge.com">merlynstonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

__._,_.___
.

__,_._,___
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )