john.perry.14 has asked for the wisdom of the Perl Monks concerning the following question:
I was wondering if it is possible to read from a text file one line at a time. I am doing a combination perl/python unofficial course at school, and the instructor told us to go to the internet for help. Of course, all the google search/perlmonks results just say to use the whole file, which is not an option. Our current assignment is to create a MadLib, but the file containing the words for the madlib contains 4 MadLibs worth of words(and is a read only file). Each MadLib worth is on a line, so how does one read text one line at a time?
Update: I don't think I was entirely clear. What I need to do is read a single line of multiple strings(CSV formatted) into an array, so is there a way to do that?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Read from a file one line at a time?
by RichardK (Parson) on Feb 20, 2012 at 17:24 UTC | |
|
Re: Read from a file one line at a time?
by choroba (Cardinal) on Feb 20, 2012 at 17:17 UTC | |
|
Re: Read from a file one line at a time?
by bitingduck (Deacon) on Feb 20, 2012 at 17:29 UTC | |
|
Re: Read from a file one line at a time?
by JavaFan (Canon) on Feb 20, 2012 at 18:23 UTC | |
|
Re: Read from a file one line at a time?
by GrandFather (Saint) on Feb 21, 2012 at 19:34 UTC | |
by john.perry.14 (Initiate) on Feb 22, 2012 at 16:55 UTC | |
|
Re: Read from a file one line at a time?
by Anonymous Monk on Feb 24, 2012 at 21:09 UTC | |
|
Re: Read from a file one line at a time?
by Anonymous Monk on Feb 21, 2012 at 16:27 UTC | |
by DStaal (Chaplain) on Feb 21, 2012 at 22:07 UTC | |
by john.perry.14 (Initiate) on Feb 21, 2012 at 16:28 UTC |