Re: How do I do this without database?
From: James Willmore (jwillmore_at_remove.adelphia.net)
Date: 10/19/03
- Next message: James Willmore: "Re: how to keep database connection persistent"
- Previous message: Tad McClellan: "Re: Any thought on "Perl Database" based on "Tie:File"?"
- In reply to: Public Interest: "How do I do this without database?"
- Next in thread: Bob Walton: "Re: How do I do this without database?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 19 Oct 2003 15:08:57 GMT
On Sun, 19 Oct 2003 04:11:32 GMT
"Public Interest" <ir@labranche.com> wrote:
> I am trying to scan stock price and volumes on a watch list. I have
> 1100 stocks on the list and I want to save them in a single file
> then use excel. Here is the format I want:
>
> symbol|price on day1|volume on day1|price on day2|price on day2|....
> IBM|98.02|203092|97.01|1212300
> SUNW|3.45|1112232|3.72|1212219
>
> I will scan the price and update add the new price and volume to the
> end of the line of each stock. The only thing I came up is to read
> the whole file in one array and add things to each element of the
> array then rewrite the whole array to the file. I know it is kind of
> breaking the RULE of not reading the whole file but only line by
> line. And it takes me 1 hours for scan all the data due to my
> dial-up connections. So I want to have something that I can start
> and pause then restart.But if I only read line by line, how do I
> append only to the end of the line not to the end of the file? It
> came back to the old question which is how to delete/modify lines in
> a text file.
>
> I am using active perl on windows.
You _could_ use DBD::CSV. In this case, the file could be treated as
a database. So, you could use SQL to manipulate the file. You _may_
not gain much as far as speed using this method.
If you're more interested in speed, use a RDBMS - such as MySQL,
PostgreSQL, etc.
You could also, since you're using Windows, M$ Access and use the
DBD::ODBC module to access the database. However, it's not an
efficent or portable solution.
Bottom line, IMHO, is give serious consideration to finding a way to
do this in a RDBMS.
HTH
-- Jim Copyright notice: all code written by the author in this post is released under the GPL. http://www.gnu.org/licenses/gpl.txt for more information. a fortune quote ... "We are on the verge: Today our program proved Fermat's next-to-last theorem." -- Epigrams in Programming, ACM SIGPLAN Sept. 1982
- Next message: James Willmore: "Re: how to keep database connection persistent"
- Previous message: Tad McClellan: "Re: Any thought on "Perl Database" based on "Tie:File"?"
- In reply to: Public Interest: "How do I do this without database?"
- Next in thread: Bob Walton: "Re: How do I do this without database?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|