I am new to PERL so please forgive me If I am being dumb here.
I have a file like below -
SLNO FirstName LastName Desgination ----------------------------------------------------- 1 Pragya Singh Developer 2 George Shepered SME 3 Akshay Bhargav SME 4 Amey Deshmukh Developer 5 Bhushan Bhatkar Quality 6 Dinesh Yadav Support ------------------------------------------------------
I want to write a PERL program for below -
Provide user an option to print all last names with designation or firstnames with designation. Depending on the user input, print the "lastname designation" or "first name designation". Keep waiting for input if not given.
I gave it a shot but only able to read\open it
#!/perl/bin/perl $fname = "Designations.txt"; open (WXYZ, $fname) or die "Couldn't open file Designations.txt, $!"; while (<WXYZ>) { print "$_"; } print "Enter First Name or Last Name: \n \n"; $name = <STDIN>; print "Entered name is : $name \n"; --------------------------------------------
After I enter the name it should give me a desgination belonging to that person.
What should I use a while loop along with if statements and match operators ??
Please help me, I am confused what if there are many names in the file.
Please help
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |