PERL EXAMPLES

1) Write a program to print the total length of the string given below, 

then extract the string and count its length.Example: "Keep your city 

clean." Extract "city" and count its length.

   Solution 1.

2) Takes the filename as an argument and display the count of words 

for that file.

   Solution 2.

3) Write a program to send a mail (only text) to a given user mail-address. 
     Solution 3.
4)Reads a line of input and print
   a) 1-if a line consists of nonzero integers,
   b) 0-if line consists of zero as a string.

    Solution 4.
5) Read in some numbers and show them in ascending and descending

 order.

    Solution 5.

6)Read lines of input containing numbers, each of which is separated 

by exactly on blank space :

   a) Total for each line,
   b) Grand total

    Solution 6.
7) Write a program that will do a minimal emulation of �bc� tool of unix 

in the following fashion:  Accept assignment operations separated by your favorite 

delimiter (for example: newline-'n�) until the program encounters the string 

�stop�. The line just above the �stop� signal will contain the expression 

the program is supposed to evaluate. The program should evaluate and

print the result of this expression.  An example operation: 
          a.       A = 4
          b.       B = 5
          c.       C = 21
          d.       D = 6
          e.       E   = A*D-C+B
          f.      Stop

So the program should Print : �Result = 8�. You may conveniently

 ignore  the operators precedence; just evaluate the expression 

from left to right.

    Solution 7.
8)Reads a list of filenames from the command line and examines 

their size. If the file is bigger than 10000 bytes, then print "Big File".
    Solution 8.

Hosted by www.Geocities.ws

1