aboutsummaryrefslogtreecommitdiff
path: root/challenge-072/pete-houston/perl/ch-2.pl
blob: 4bcb7862ecfa24e5a2dd88bb9b28c24231ecf3af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env perl 
#===============================================================================
#
#         FILE: 7202.pl
#
#        USAGE: ./7202.pl LINEA LINEB FILE [ FILE ... ]
#
#  DESCRIPTION: Display lines from number A to B inclusive of FILE on STDOUT
#
#        NOTES: Optimised for memory, not speed
#       AUTHOR: Pete Houston (pete), cpan@openstrike.co.uk
# ORGANIZATION: Openstrike
#      VERSION: 1.0
#      CREATED: 04/08/20
#===============================================================================

use strict;
use warnings;
use autodie;

my $start = shift @ARGV;
my $end   = shift @ARGV;
print "start = $start, end = $end\n";
for my $file (@ARGV) {
	open my $in, '<', $file;
	<$in> for 2 .. $start;
	print '' . <$in> for ($start .. $end);
	close $in;
}