By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,933 Members | 1,676 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,933 IT Pros & Developers. It's quick & easy.

reading a file

P: 2
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
Nov 19 '08 #1
Share this Question
Share on Google+
4 Replies


P: 2
I found the answer


Thanks
Nov 19 '08 #2

eWish
Expert 100+
P: 971
What was the answer?
Nov 19 '08 #3

Icecrack
Expert 100+
P: 174
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
Nov 19 '08 #4

KevinADC
Expert 2.5K+
P: 4,059
the answer is:

Expand|Select|Wrap|Line Numbers
  1. open(FILE, 'filename');
  2. @lines = <FILE>;
  3. chomp @lines;
  4. close FILE;
  5.  
Nov 19 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.