Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parsing text in perl for posting into database

Status
Not open for further replies.

alphaaa

Technical User
Jan 15, 2002
45
US
i would like the text to appear as it is posted. I'm using text area tage with rows and colums defined with post as the method to send the data. At the other end im using perl scripts to get the data and load it to the database. Now when i receive the data it comes in one line instead of in rows and clumns or they way it was posted. What do i have to do to break the data into rows and columns exactly as it was posted by the end user? I hope i explained it clearly.
data field for my column is VARCHAR2.
Thanks for answering.

 
You really need to give more details. It may be clear to you what you are doing, but not to everyone else

svar
 
sorry for not clearifying my problem clearly.
to me it is very quite clear (obeviously)
lets take an example.
This is the text i want to write down in my forum my table looks like this.
" quantiy id_number price
20 13456 2.45
15 13876 5.55
25 13767 1.99 "
After posting that text into forum it should look like exactly as it is with spaces and columns, however in my scenario the text out put look like this.
" quantiy id_number price 20 13456 2.45 15 13876 5.55 25 13767 1.99 "


 
3 possible ways to accomplish this. 1st, and easiest, would be to make input areas instead of text boxes. Then no need to parse values from a long string and processing/server load will be a little faster.

2nd, assuming that data is fixed length, you could use nested substring functions to strip out the 3 sets of data and the individual bits of data - but this ugly.

3rd would be to parse everything between white space. This would be your data. You'd have to build some sort of logic into it to keep track of what each parsed bit of data was and where it should go in the database. There's always a better way...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top