aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xchallenge-072/jo-37/perl/ch-2.pl12
1 files changed, 9 insertions, 3 deletions
diff --git a/challenge-072/jo-37/perl/ch-2.pl b/challenge-072/jo-37/perl/ch-2.pl
index 423ed6ca80..95a529b5a5 100755
--- a/challenge-072/jo-37/perl/ch-2.pl
+++ b/challenge-072/jo-37/perl/ch-2.pl
@@ -1,10 +1,12 @@
-#!/usr/bin/perl
+#!/usr/bin/perl -T
use strict;
use warnings;
sub print_range {
- my ($file, $A, $B) = (shift, shift() + 0, shift() + 0);
+ my $file = shift;
+ my ($A) = shift =~ /^(\d+)/;
+ my ($B) = shift =~ /^(\d+)/;
return if !$file || $A < 1 || $B < $A;
@@ -18,4 +20,8 @@ EOS
close $fh or warn "$file: $!\n";
}
-print_range 'ch-2.in', 3, 5;
+if (@ARGV) {
+ print_range @ARGV;
+} else {
+ print_range 'ch-2.in', 3, 5;
+}