in reply to Parsing and adding to a "variable".
What database are you using? Be careful! Some databases, like MySQL, limit the TEXT size (in the case of mysql if you try to send text to the database larger then the packet size compiled in you will have your TEXT truncated).
Whatever you decide to deliniate paragraphs with, (some suggestions: m/\n\n/, m/\n\t/, m/\r\n/, whatever else you decide, use a regular expression and the split command, i.e. my @paragraphs = split /\n\n/, $the_text. Then you can use my $number = scalar (@paragraphs) (scalar not necessary because it's in scalar context but used for clarity). Remember to use the %, modulus operator, to get the remainder when dividing so you don't get a weird decimal!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parsing and adding to a "variable".
by powerhouse (Friar) on Jan 24, 2004 at 06:26 UTC | |
by Vautrin (Hermit) on Jan 24, 2004 at 15:12 UTC | |
by powerhouse (Friar) on Jan 25, 2004 at 00:24 UTC | |
by ysth (Canon) on Jan 25, 2004 at 05:40 UTC | |
by powerhouse (Friar) on Jan 25, 2004 at 14:38 UTC | |
by ysth (Canon) on Jan 25, 2004 at 20:29 UTC | |
by ysth (Canon) on Jan 25, 2004 at 18:16 UTC |