You are on page 1of 2

1.

Write a Perl script that reads all input from the standard input file and sorts all the words in
reverse order, printing out one word per line with duplicates omitted.

2. Write a Perl script that takes a list of files and indicates, for each file, whether the user has read,
write, or execute permission.

3. write a Perl script to replace a part of an array with another array and print the updated array.
(using splice)

4. Write a Perl script to filter out the numbers form an array using “grep” and change the array using
“map” , “chop” and “chomp”.

5.Write down regular expressions that are matched by:


a. a sentence (something that begins with a capital letter and ends with a full stop);
b. any number that is a multiple of 5;
c. any string whose length is a multiple of 5;
d. any four digit number that reads the same backwards as forwards (like 4114);
e. a number in Roman numerals (can you ensure that it is correctly formed?);
f. any `word character' except Q (try to make your regular expression as short as possible).

6. Write a Perl script that encrypts a password and then asks the user to guess it. Give the user three
chances to get it right.

7. Write a Perl script that reads input lines consisting of a student name and five numbers
representing the student's marks in English, history, mathematics, science, and geography, as
follows:
Jones 61 67 75 80 72
Use an associative array to store these numbers in a database, and then print out the names of all
students with failing grades (less than 50) along with the subjects they failed.

8. write Perl script to assign two different array to a hash and print the values of it.

8.Write a Perl script that prints Hello! if you pass the -H switch to it and that prints Goodbye! if you
pass the -G switch.

9. Write a one-line program that converts all lowercase letters to uppercase.(using command line
options)

10. Write a program that replaces all the newline characters in the file testfile with colons. Use only
command-line options to do this.

11. Write a program that reads a number. If the number is a floating-point value, print it in
exponential and fixed-point form. If the number is an integer, print it in decimal, octal, and
hexadecimal form. (Hint: Recall that printf and sprintf use the same field specifiers.)

12.Create a class to list the entire directory tree when given a path name.

13. write a script for the given verilog file contains more than one modules to the one module for
one file

14. write a Perl script to write the pins and buses of verilog file into a other file
( bus represents vector)
expected output:
pins(a,b.....g);
bus(h,i.....l);
15. Write a program that reads a file from standard input, breaks each line into words, uses grep to
get rid of all words longer than five characters, and prints the file.

16. Write a Perl script for finding the user is logged on?

17. Write a Perl script that throws away any values for the DATA filehandle included at the end of
another Perl script.

18. Write a Perl script that uses hot keys and does the following:
Reads single digits and prints out their English-language equivalents (for example, zero for 0, one
for 1, and so on)Terminates if it reads the Esc (escape) character Ignores all other input Prints out
one English word per line.

19. Input a name. Check if it is valid (has at-least 3 letters and one vowel) using only return
functions and regular expressions in Perl. Do not use parse functions.

20. write a Perl script to remove a duplicate lines from a file.

21. Write a Perl script for following:


a. fibinocci series (input taken from runtime)
b. armstrong number
c. pascal traingle

You might also like