in reply to How do I extract (x) number of lines from database?
If this isn't what you meant, please clarify.use strict; my ($begline, $endline); open DATA, "<indb.txt"; my @lines = <DATA>; chomp @lines; foreach ($begline..$endline) { my ($var1, $var2, $var3) = split '\|', $lines[$_]; print "$var1 $var2 $var3\n"; # do whatever }
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]}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How do I extract (x) number of lines from database?
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 | |
| [reply] [d/l] |
by jlongino (Parson) on Sep 21, 2001 at 19:02 UTC | |