Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need some help with this question I would really appricate it Write a Perl script that accepts exactly 2 integer arguments where the first

I need some help with this question I would really appricate it

Write a Perl script that accepts exactly 2 integer arguments where the first argument must be less than the second argument. The script will print a comma separated list of integers starting with the first argument up through the second argument. The last printed value should be the second command line argument not be followed by a comma. The script should also be able to handle the following errorsituations: o incorrect number of arguments o the first argument is not less than the second argument (dont worry about trying to handle non-integer arguments)

Here is what needs to be fixed following the instructions above

#!/usr/XXX/XXX

# Script names: intlist.pl # Case #1: ./intlist.pl value # Check for the correct number of arguments on the command line. unless (SYNTAX(@SYNTAX)==2){ print "error: incorrect number of arguments", " ", "usage: intlist.pl a b (where a < b)", " "; exit VALUE; }

# Check that first argument is smaller than second if ($SYNTAX[INDEX] OPERATOR $SYNTAX[INDEX]){ print "error: first argument must be less than second argument", " ", "usage: intlist.pl a b (where a < b)", " "; exit VALUE; }

# prints arguments else {

$COUNTER=$SYNTAX[INDEX]; # Set COUNTER variable to low integer value

# Print integers until upper limit integer is reached while($VARIABLE<=$ARGV[INDEX]){ print $VARIABLE; if ($COUNTERRELATIONAL OPERATOR$ARGV[INDEX]){ print ", "; } else { print " "; } $COUNTERSYNTAX } } COMMAND VALUE;

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

More Books

Students also viewed these Databases questions

Question

Discuss the Customs Trade Partnership Against Terrorism (C-TPAT).

Answered: 1 week ago