Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Re: Reading multiple lines?

by matthew (Acolyte)
on Nov 29, 2000 at 01:53 UTC ( [id://43787]=note: print w/replies, xml ) Need Help??


in reply to Re: Reading multiple lines?
in thread Reading multiple lines?

Got an even better one:
#!/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; }
-Matthew

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://43787]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-18 23:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found