Question
Perl Program: You must write a Perl program that will provide a listing of files in a directory. The files must be listed in sorted
Perl Program:
You must write a Perl program that will provide a listing of files in a directory. The files must be listed in sorted order by the file name.
By default, the program displays only file names.
By default, the program lists the files in the current directory.
The program must provide the following command line options to the user:
d [directory]: This option allows the user to specify a directory or no directory name. If the -d option is provided without specifying a directory name, list your current directory (~student user name/itec400/homework). The output shall be displayed using the following column headers: File Name Size Owner Group
l: This option instructs the program to display a long listing. The output shall display the following column headers: File Name Size Owner Group
The user selects no options. List the file names under your current directory (~student user name/itec400/homework). The output shall display the following column header: File Name
The script file name must be: listdir.pl
Sample output:
User selects no options (provide column header and list file names): > listdir.pl File Name 4th 4th_log 4th.old 4th.old.2 address.cpp address.h address.o
User selects -l option (only subset of output isshow): > listdir.pl -l File Name OUTPUT HERE Size Owner Group
User selects -d option. > listdir.pl d File Name Size Owner Group OUTPUT HERE
User selects -d option without specifying a directory name. > listdir.pl d File Name Size Owner Group OUTPUT HERE
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