in reply to Parsing Script

I'm trying to figure out how to populate the databse with content from the Read_File sub. And how can i integrate the Scan_File sub into my program so that instead of those print line in the Read_File sub it populate the databse.

Your code is not huge, but it is still too much for me to really want to read it in detail. At a cursory glance, however, I notice some issues:

However you have two orthogonal issues here:

Once you figure out how to do both, you can "link" them together: gathering data for putting it into the database won't be any different than doing so for printing it and putting that stuff into the database won't be terribly different than putting into it any other kind of data.

Replies are listed 'Best First'.
Re^2: Parsing Script
by phimtau123 (Novice) on May 24, 2007 at 19:45 UTC
    pardon my clumsy code...this is my first script with perl, and i've only got 1 programming class like 3 year ago...so hehe i kindna suck at it...... but i'm really lost in how to push the data i got from the text file into the database.....can u direct me to a link where i can read up on it? also when u said unnecessary for loop, wat would be a better way of doing it? C-style is the only way i have been expose to. OR how else can i do the if-else statement to make it more efficient?
      pardon my clumsy code...this is my first script with perl, and i've only got 1 programming class like 3 year ago...so hehe i kindna suck at it......

      No problem, we're all here to learn.

      but i'm really lost in how to push the data i got from the text file into the database.....

      I'm not a database guru, but you use DBI yourself, so you should really read its docs. However I suppose you simply want some INSERT's. OTOH you may also want to use some higher level tool, like Class::DBI or DBIx::Class...

      also when u said unnecessary for loop, wat would be a better way of doing it? C-style is the only way i have been expose to.

      Perl-style is documented in perldoc perlsyn and is almost always appropriate in Perl:

      for (1..5) { Do::Something::with($_); }
      OR how else can i do the if-else statement to make it more efficient?

      Did I talk about "efficiency"? It's not a matter of efficiency. It's a matter of expressiveness. However, lotsa ways, also depending on the actual situation. For example hash lookup (possibly in the form of a lookup table) or, in your case and still at a quick glance, I would say even array lookup.