in reply to Re: I need help with displaying newline or paragraph using perl on my website
in thread I need help with displaying newline or paragraph using perl on my website
I have tried option one and it did not work. I am not so good at regular expression although i am learning gradually about it.
Please are there resources online where i can get help or read about what i need to do in other to display paragraphs as i did while inserting text into a database using Perl.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: I need help with displaying newline or paragraph using perl on my website
by ww (Archbishop) on Jun 28, 2014 at 23:38 UTC | |
Depends on what you mean by "get help" -- if you mean 'do it for you,' hire a programer. If you mean help fix your code, you'll have to show it to us, and not just say "it did not work." But if you mean 'get help learning how to....' -- well, http://www.perlmonks.com/index.pl?node=Tutorials#Pattern-Matching-Regular-Expressions-and-Parsing is just awaiting your visit. And in that same vein, I'm not clear what you $text looks like, coming out of the database, so can't even guess why the snippet you show does "not work." However, another and better option might be to stick the text into the db with html markup...
That:
combined with whatever escaping demanded by your code, should do the job. BTW, re the first reply, above, <br /> is NOT para code as the node might seem to suggest. It's an entity which produces a single linebreak (like 0d, 0a in a windows file) but not a para break which puts in an extra linebreak so paras are separated by a line blank except for the newline. | [reply] [d/l] [select] |
by 5plit_func (Beadle) on Jun 29, 2014 at 20:28 UTC | |
| [reply] [d/l] |
by Anonymous Monk on Jun 29, 2014 at 22:45 UTC | |
Why aren't you passing $dbh around? You should do that, and you should have more subs, and pass more arguments; programming, its all about argument passing and good subroutine names :) if you need comments to explain what the subroutine does you need to change your subroutine name No comments like this >> A subroutine for the database connection if the name db_connect does doesn't communicate that, change it, name your subroutine database_connection ... Ways of commenting subroutines To give you some ideas Read more... (6 kB)
You can see i haven't quite thought it through... but you should do that, its your app :) sub Main is a good example, the idea is to model the app in its own terms Probably print ArticleDance...; is what it should be where ArticleDance does return $headers, $body; ... so there are no sub print_... they all just return $stuff update: here is some of those changes Read more... (6 kB)
For the whys and the hows of some things see Tutorials: Variable Scoping in Perl: the basics, placeholders bobby-tables.com: A guide to preventing SQL injection in Perl see Re: No such file or directory error/No such file or directory error, see template at (tye)Re: Stupid question (and see one discussion of that template at Re^2: RFC: Creating unicursal stars | [reply] [d/l] [select] |