Mosley has asked for the wisdom of the Perl Monks concerning the following question:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How do I extract (x) number of lines from database?
by AidanLee (Chaplain) on Sep 21, 2001 at 08:30 UTC | |
if you've got them in an array it should be fairly easy to do this using an array slice.
you can put variables in for the bottom and top of your slice range. p.s., you might really want to consider using either a templating system, CGI.pm, or at the very least HEREDOC syntax to deal with all that messy html output. | [reply] [d/l] |
by Anonymous Monk on Sep 21, 2001 at 09:16 UTC | |
| [reply] |
|
Re: How do I extract (x) number of lines from database?
by jlongino (Parson) on Sep 21, 2001 at 07:19 UTC | |
If this isn't what you meant, please clarify. Update: Of course you need to initialize $begline, $endline as needed. Also, keep in mind that @lines begins with an index of zero, not one. @a=split??,'just lose the ego and get involved!';
for(split??,'afqtw{|~'){print $a[ord($_)-97]} | [reply] [d/l] |
by Mosley (Novice) on Sep 21, 2001 at 08:11 UTC | |
| [reply] [d/l] |
by jlongino (Parson) on Sep 21, 2001 at 09:29 UTC | |
Update: If it wasn't so late, I'd have used a hash with the first field (linenum/ID) as the key field. Maybe a monk in a different timezone could illustrate. As it is, I just fudged the 10-20 with 9-19, which is fine for quick and dirty, but not too aesthetic. @a=split??,'just lose the ego and get involved!';
for(split??,'afqtw{|~'){print $a[ord($_)-97]} | [reply] [d/l] |
by Anonymous Monk on Sep 21, 2001 at 17:22 UTC | |
by jlongino (Parson) on Sep 21, 2001 at 19:02 UTC | |