You are on page 1of 2

Perl Programming Assignment - 1

Prof. H.B. Dave January 7, 2009
Major Topics: identifiers - scalers, array, hash; contexts - scaler, list; Expression - arithmatic, logical, relational, etc.; String operations and Patterns matching; Introduction to control structures - if/else, while loop; Simple input from STDIN.

Assignment 1a
Write a Perl program to read month number (an integer in the range 1 to 12) as command-line argument and convert and print the month name. You should do validity check on the input.

Assignment 1b
Write a Perl program to read an integer in the range 1 to 9999 as command-line argument and convert and print the value in words. You should do validity check on the input.

Assignments 1c, 1d
Modify the above two programs to take input from the STDIN. Check proper operation of your programs by tty input and by an input file redirection.

Assignment 1e
Modify the program for 1b above, for printing ”Fourteen” etc by catenating ”Four” and ”teen”, etc. Explain which code is better.

1

Assignment 1f
Write Perl program to convert an integer value between 1 to 9999, given in words as a single command-line argument, to corresponding numerical value and print it. First get the program working, and then make it robust.

2