Question
PERL - Simple PERL scripts to do the following: 4. Write a program that reads in a file (pick any file from the directory) and
PERL - Simple PERL scripts to do the following:
4. Write a program that reads in a file (pick any file from the directory) and display the contents of that file, line by line. Make sure the end of file is handled properly, and remember to close the filehandle after you are finished. Prompt the user for the filename to be read.
5. Modify the last program you wrote to incorporate the die statement to handle file open errors. You can use a custom message if you want.
6. Write a program that creates a file called data.dat in the current directory. Prompt the user for five numbers, and write them, one at a time, on both the screen and into the file. Close the file, then open it again for reading only, and display the contents on the screen. Handle error conditions that may occur.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started