Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
how can i ammend the above code? thanks#!/usr/bin/perl -w use strict; my $n_lines = 10; my $file = 'test'; my @lines; open(FILE, $file)|| die "Can't $!"; for (1 .. $n_lines) { push @lines, scalar <FILE>; } close FILE; print @lines;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: print lines from a file
by TedYoung (Deacon) on Feb 17, 2005 at 21:30 UTC | |
|
Re: print lines from a file
by artist (Parson) on Feb 17, 2005 at 21:58 UTC | |
|
Re: print lines from a file
by Roy Johnson (Monsignor) on Feb 17, 2005 at 22:05 UTC | |
|
Re: print lines from a file
by Animator (Hermit) on Feb 17, 2005 at 21:26 UTC | |
|
Re: print lines from a file
by sh1tn (Priest) on Feb 17, 2005 at 22:56 UTC |