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.


In reply to Re^3: Parsing Script by blazar
in thread Parsing Script by phimtau123

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.