Thanks for your input. Now let me re-iterate my problem this way. Suppose I have simple a.txt(pasted below) file in my desktop. When I open that file on the browser by giving the unix path/windows path ...it comes in proper order and indentation.
But when I am reading this file in a string and inserting the string in a database column and later on using cgi perl printing it on the webpage , it gets messed up.
What magic is happening when I do print $htmldata in my cgi perl code so that it destroys the order and indentation of the text ?
But it is coming as :
name phone xyz 123 abc 890
Re^3: How to convert a text file to a HTML file
Replies are listed 'Best First'.
html generally ignores white space, so if you want it displayed in a particular layout then you need to add some markup.
Try wrapping your text in a pre tag i.e. <pre>your text here</pre>
BTW the browser knows how to display different file types, but if your app tells the browser it's sending html and then just sends plain text, it's not surprising that you don't get the results you expected.
You've posted no code, why make people guess what $htmldata is? You don't show us how you read this input, what processing is done on the input or how you display your output. If all you do is read the data into a variable and print it within a webpage it isn't going to display in the same manner it did within your text editor. You need to learn about HTML, and basic perl. Rather than have to reiterate your problem consider putting some thought into your posts, and asking a real question, How do I post a question effectively?.
Yes it is just a single line , so I did not put a code.
But I have mentioned that I am fetching the concatenated string from the database and I assumed that people would
understand $htmldata is holding that value fetched from database.
I am using a fetchrow_hashref function to fetch the data .
First off, you replied to yourself, you've posted here many times, if you wish to reply to someone click the "reply" link within the post in question. Secondly you're still missing the point, you don't mention how you read the input data, how you process it (parse it from the format it's in into HTML) and how you display it. But I mentioned this already, among other things. If you continue to ignore what people say in response to your questions then you're wasting your time.