Question: Write a Perl program that reads a number of rows from a file as string variables, in a function Read() , containing a while loop

Write a Perl program that reads a number of rows from a file as string variables, in a function Read(), containing a while loop controlled by a string variable receiving the file row values, which should terminate the loop on an EOF (end of file) value. Save the strings into a list variable, and pass the string variable to a Write() function. The Write() function should write the string variable into a file, and also print each string at the command line each time the loop does a new write into the text file.

Let's say the strings are names, the read file is file.txt, and the write file is new.txt.

Please write and explain all the lines of your program. Thank you!

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!