diff options
| author | Yary Hluchan <yhluchan@apple.com> | 2020-08-03 14:41:37 -0400 |
|---|---|---|
| committer | Yary Hluchan <yhluchan@apple.com> | 2020-08-03 14:41:37 -0400 |
| commit | 723afc9a452054a0928d4b916fb94cb7695a545a (patch) | |
| tree | 52408686a705f50e9dc7f4f7ff1efb84c722f98e | |
| parent | 25365364c03d323564aad1593e3a769fb3815d09 (diff) | |
| download | perlweeklychallenge-club-723afc9a452054a0928d4b916fb94cb7695a545a.tar.gz perlweeklychallenge-club-723afc9a452054a0928d4b916fb94cb7695a545a.tar.bz2 perlweeklychallenge-club-723afc9a452054a0928d4b916fb94cb7695a545a.zip | |
Solution for line-range puzzle, Classic Perl
| -rw-r--r-- | challenge-072/yary-h/input.txt | 12 | ||||
| -rw-r--r-- | challenge-072/yary-h/range.pl | 14 |
2 files changed, 26 insertions, 0 deletions
diff --git a/challenge-072/yary-h/input.txt b/challenge-072/yary-h/input.txt new file mode 100644 index 0000000000..756958ea91 --- /dev/null +++ b/challenge-072/yary-h/input.txt @@ -0,0 +1,12 @@ +L1 +L2 +L3 +L4 +L5 +L6 +L7 +L8 +L9 +L10 +L11 +L12 diff --git a/challenge-072/yary-h/range.pl b/challenge-072/yary-h/range.pl new file mode 100644 index 0000000000..204bd2255c --- /dev/null +++ b/challenge-072/yary-h/range.pl @@ -0,0 +1,14 @@ +#!/usr/bin/env perl +# Run as: +# range.pl 4 10 < input.txt +# or +# range.pl 4 10 input.txt + +my ($begin_line, $end_line)=splice @ARGV,0,2; + +# Not using flip-flop .. want to simply exit on the end line +while (<>) { + next if $. < $begin_line; + print; + exit if $. >=$end_line; +} |
