-Matthew#!/usr/bin/perl my $file = "../data/foo.txt"; my @lines = getFileSlice($file,"10","1"); print join "", @lines; print "\n"; sub getFileSlice() { my $file = shift; my $length = shift; my $offset = shift; my @lines; open FILE, "../data/foo.txt"; for($i=0;$i<$offset;$i++) { <FILE> } for($i=0;$i<$length;$i++) { my $line = <FILE>; push @lines, $line; } close FILE; return @lines; }
In reply to Re: Re: Reading multiple lines?
by matthew
in thread Reading multiple lines?
by rdw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |