reading a file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • newjoinee
    New Member
    • Nov 2008
    • 2

    reading a file

    Hi, I have a file something like this: which is the input to my script

    1:
    this is a line

    2:
    this is another line

    3:
    this is the third line.



    Im trying to read this file, split and use the numbers and text as separate fields.



    Im doing this to insert these fields as values in an SQL table using mysql.

    However im not sure as to how to proceed with it,


    Kindly help


    Thanks
    Last edited by newjoinee; Nov 19 '08, 12:05 AM. Reason: i found the answer
  • newjoinee
    New Member
    • Nov 2008
    • 2

    #2
    I found the answer


    Thanks

    Comment

    • eWish
      Recognized Expert Contributor
      • Jul 2007
      • 973

      #3
      What was the answer?

      Comment

      • Icecrack
        Recognized Expert New Member
        • Sep 2008
        • 174

        #4
        it will be a good thing to put the answer up as it will help others find a solution to the problem you had.

        Thanks

        Charlie

        Comment

        • KevinADC
          Recognized Expert Specialist
          • Jan 2007
          • 4092

          #5
          the answer is:

          Code:
          open(FILE, 'filename');
          @lines = <FILE>;
          chomp @lines;
          close FILE;

          Comment

          Working...