#!/usr/bin/perl -w use strict; # Error checking! die "Required argument missing!\n" unless ($#ARGV > 0); # This along with the following code ensures a positive numeric range. my $last = 0; # More Error handling! for (@ARGV) { # Ensures numeric input! die "Argument \"$_\" is not numeric!\n" unless (/\d+/); # Ensures a negative number was not entered as first argument and # also that the second argument is higher in value then the first. die "Invalid range!\n" unless ($_ > $last); $last = $_; } # Here we know that there was some sort of input at command line. # We also know that each argument is numeric. # We also know that the user gave a valid range in order for the app # to print out a consecutively increasing numeric count. # So with all the error handling passed if the program gets to this point. # we know we have the required VALID command line input in order for us to # successfully run this program. for ($ARGV[0] .. $ARGV[1]) { print; print"\n"; }