in reply to Perl scripts to do extraction into Sybase

A big question indeed. I doubt that there is one script that does everything you want all at once, so you would be best to take things one at time.

First of all, look here for a good introductory tutorial that should head you off in the right direction. Perl Monks' own tutorials contain a wealth of information.

Next, epoptai's home node has links to a number of online books that you might want to keep handy. You might want to consider reverse engineering the scripts you have using these books, since (I assume) you know what they do, if not exactly how they do it.

Not sure what a particular function does? Try "perldoc -f" followed by the name of the function at the command line...

Specifically regarding databases and Perl, I found this tutorial very clear and concise for a newbie like me:

One of the most confusing things I found about Perl when I first started where the regular expressions (seen something like s/\t.?\\s/ in your code?). Check out String matching and Regular Expressions and Common Regex Gotchas for help on this issue.

I hope this has been of some help. Good luck...

*~-}o{-~*

  • Comment on Re: Perl scripts to do extraction into Sybase

Replies are listed 'Best First'.
Re: Re: Perl scripts to do extraction into Sybase
by ash_meh (Initiate) on Jan 10, 2001 at 03:52 UTC
    thank you for the prompt reply.. and apologies for putting so much in one Qs. :) anyways, let me rephrase my Qs: how would you load data from a flat file into a sybase database using perl scripts?

      2 issues for you, best tackled one at a time. I've had to learn to do them both over the last little while, and barely suffered at all :)

      1. Reading flat files. This is a v. basic example which reads the file line at a time and prints the results. You could modify this approach to send to Sybase instead:
        #!/usr/local/bin/perl -w if (open(MYFILE, "path/to/file")) { $line = <MYFILE>; while ($line ne "") { print ($line); $line = <MYFILE>; } }
      2. Talking to a Sybase database. You'll need to come to grips with DBI/DBD. I doubt you will find it too difficult. It is pretty much a case of connecting to the database, executing an SQL command, then retrieving the results. The Tricks with DBI tutorial by btrott should head you off in the right direction.

        Have a look at davorg's reply below as well :)

      *~-}o{-~*