Problem 1
You must create a hash and use hash access functions to receive
credit for this problem.
Create a script using only Perl named problem1 in the
appropriate directory. Your program should parse
the /etc/passwd file and create a hash with all of
the accounts listed. Use the UID as the key value, and
username as hash value . For informational purposes, the
username is in the first column, the UID in the
third.
Prompt the user to enter a UID. Retrieve the information
from the hash regarding that UID and display it on the
screen. Ask the user is they want to try again. Accept
exit or quit to exit the program, otherwise accept a UID and look
it up.
Example interaction with the program (your values might be
slightly different):
Please enter a UID: # user types 1000
The owner of UID 1000 is student # program output
Do you wish to continue? (uid, exit or quit) # user types
1
The owner of UID 1 is root
Do you wish to continue? (uid, exit or quit) #user types
exit
$
Problem 1 You must create a hash and use hash access functions to receive credit for this problem. Create a script using
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Problem 1 You must create a hash and use hash access functions to receive credit for this problem. Create a script using
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!