Question: Need help with perl script, using perl 5 on windows. running it through windows command prompt with perl -w Create a text file called calendar

Need help with perl script, using perl 5 on windows. running it through windows command prompt with perl -w

Create a text file called calendar that looks like this:

11/17/1999 - Doctor's appointment.

12/6/1999 - Dentist appointment.

12/23/1999 - Christmas party.

1/23/2000 - Meet with business advisor.

1/13/2000 - Business trip to Hong Kong.

2/25/2000 - Business trip to Kansas City.

1/5/2000 - Car service.

3/18/2000 - Birthday party.

4/10/2000 - Meet with tax accountant.

3/12/2000 - Conference in San Jose.

12/31/1999 - New Year's party.

Write a program that opens and reads the calendar file. Then the program writes back in the calendar file the original content, sorted in ascending order by date.

The main code should be 7 lines of code, or less:

open the file for input

read all the input data

close the file

sort the dates

open the file for output

print the result to the file

close the file

Use the sort function. In addition to the main code, you will need to code a sort subroutine that compares the dates of two records. This subroutine should be called by the sort function.

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!