Question: LINUX - Create a perl program that does the following: *Reads integers from a file called input7.txt that has the numbers (100, 90, 85, 0,

LINUX - Create a perl program that does the following:

*Reads integers from a file called "input7.txt" that has the numbers (100, 90, 85, 0, 78, 0, 90) (Make sure there is a new line after the last number)

* Prints the numbers on the screen along with its order in the file

* Calculates the average of the numbers, in a seperate function called avg by passing in the sum and count of the numbers

Please show a screenshot of the program and that it looks exactly like what is on the paper below! Thank you. :)

LINUX - Create a perl program that does the following: *Reads integers

List of Tasks Use vi to create a file named lab7.pl containing a Perl program that reads integer numbers from a file, prints them on the screen, and calculates their average. Make sure your name and course are at the top of the file (as a comment) Your program must read the values, sum them and count them, and pass these last two values to a function named avg that returns the resulting average. Since the input might be empty, your function must avoid division by zero. Thus, it should display "The average is: 0" if no values were read from the file. Your program must read the numbers from a file named input7.txt (use vi to create this file - make sure there is a newline after the last number). For each integer in the input, display it preceded by its order in the file. After displaying all the numbers, display their average. Make sure your name and course are at the top of the program. Example: The output should look like the one below. The values read from the file are: : 100 2:90 3: 85 4:0 5: 78 6: 0 7:90 The average is: 63

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!