canguro has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I'm new to PERL, although I've worked in mainframe COBOL programming applications for years. I have read that PERL is easy to use yet powerful, and so I got interested in learning it.

To all you experts out there, can someone tell me if the following scenario can be perfomed thru PERL? What I'd like to do is write a script in PERL that would allow me to retrieve data from a Web site, download it to a specific directory on my hard drive, and then do some editing on that file before sending it on to an Oracle database. I'm not asking how to do it, simply whether PERL can accomplish it.

What I normally do is go to a site where I type in a stock ticker symbol and a date range and retrieve the following data: Open, High, Low, Close, and Volume for the date range, and then save (download) it to a .CSV format file in a specific directory.

Can I develop a PERL script that would do the above? And perhaps even build a 'driver' file of ticker symbols to retrieve the above data for a set of stocks? I'm just curious to know if the answer is YES or NO.

With many thanks in advance,

Joe

Added <p> tags - dvergin 2003-04-04

  • Comment on Newbie to PERL curious about what it can do

Replies are listed 'Best First'.
Re: Newbie to PERL curious about what it can do
by MrYoya (Monk) on Apr 05, 2003 at 01:05 UTC
    Yes, you can do that in Perl. You can use the LWP module to connect to the website, and DBI to talk to the database.
Re: Newbie to PERL curious about what it can do
by waswas-fng (Curate) on Apr 05, 2003 at 01:07 UTC
    Yes. Check out LWP to suck off the web, and DBI to access your db. O'REILLY has an awesome selection of perl books to help you learn the language.

    -Waswas
Re: Newbie to PERL curious about what it can do
by Anonymous Monk on Apr 05, 2003 at 01:24 UTC

    I should note I'd correct you on the capitalization of "Perl" (or "perl" depending on whether or not you're referring to the implementation), but since I write COBOL as cobol, it would be a little too hypocritical, even for me :).

    I've worked in mainframe COBOL programming applications for years.

    Why not just use cobolscript then? It's the logical progression. I quote from their page:

    CobolScript® is a COBOL based scripting language. Anyone who already knows COBOL can easily use CobolScript to build server-side scripts with virtually no learning curve. CobolScript has familar COBOL syntax and is ideal for data conversion, batch interfaces, and server-side scripting. CobolScript is cross-platform compatible, with versions for the following operating systems:...

    Who needs Perl right?

    If you do decide to use Perl, after you learn the basics (reading through learning perl should suffice) and do a couple searches on The CPAN what you're asking would probably take you 1-2 hours. But who wants that?

Re: Newbie to PERL curious about what it can do
by canguro (Novice) on Apr 05, 2003 at 10:26 UTC
    Thanks to all who replied to my question. I was very pleased to hear that what I wish to accomplish is indeed possible, and I will definitely look into the LWP and DBI modules for enlightenment on my 'task to be'. This encourages me to increase my endeavours in learning PERL. Thanks again!
Re: Newbie to PERL curious about what it can do
by Anonymous Monk on Apr 05, 2003 at 16:19 UTC
    Why do you wish to accomplish this task?

    If you need to do it for personal interest, go right ahead. If you need to do this for your employer, these sites have licenses which say that you can't. To get this information (legally) you generally need to buy it from someone.

    While Perl can do many things, it cannot make what is illegal magically legal.

      I would say that scraping a site for your own use is usually 'ok' -- you are just using a different app to expose the view. If he were to use the data and export to other people, that may cross the line depending on the copyright notice or Terms of the site. either way he did not give enough information in his post to lead me to beleave he was

      -Waswas
Re: Newbie to PERL curious about what it can do
by canguro (Novice) on Apr 07, 2003 at 20:46 UTC
    Waswas, You are correct. I am simply interested in using Perl for my own personal project. In the process I am very excited about the possibility of doing something useful (retrieving the stock data and then testing my own homegrown systems in Oracle) AND also the idea that I might achieve some level of expertise in Perl, which I've heard great things about.