Scripting Language
Scripting Language
Scripting Language
FOR WOMEN
(Approved by AICTE, New Delhi and Affiliated to JNTUH)
Nizampet Cross Road, JNTUH Kukatpally Hyderabad–500085
LABORATORY MANUAL
I List of Experiments ii
II V/M /POs/PSOs/PEOs iv
III Syllabus ix
i
List of Experiments
Exp. No. Experiment Name Page No.
1 Write a Ruby script to create a new string which is n copies of a given string where n
is a non-negative integer
2 Write a Ruby script which accept the radius of a circle from the user and compute the
parameter and area.
3 Write a Ruby script which accept the users first and last name and print them in
reverse order with a space between them
4 Write a Ruby script to accept a filename from the user print the extension of that
7 Write a Ruby script to check two integers and return true if one of them is 20
otherwise return their sum
8 Write a Ruby script to check two temperatures and return true if one is less than 0 and
the other is greater than 100
10 Write a Ruby program to retrieve the total marks where subject name and marks of a
student stored in a hash
14 Write a TCL script to (i) create a list (ii) append elements to the list (iii) Traverse the
list (iv) Concatenate the list
17 a) Write a Perl script to find the largest number among three numbers. b) Write a Perl
script to print the multiplication tables from 1-10 using subroutines.
19 a) Write a Perl script to substitute a word, with another word in a string. b) Write a
Perl script to validate IP address and email address.
ii
20 Write a Perl script to print the file in reverse order using command line arguments
iii
RISHI M.S INSTITUTE OF ENGINEERING & TECHNOLOGY FOR WOMEN
(Affiliated to JNTUH University, Approved by AICTE)
Department of Computer Science And Engineering & Information Technology
To be a center of excellence in producing women engineers and scientists who are professionally
competent social leaders to face multi-disciplinary global environment by imparting quality technical
education, values and ethics through innovation methods of teaching and learning.
To promote women technocrats capable enough to resolve the problems faced by the society using
the knowledge imparted.
To prepare self-reliant women engineering for technological growth of the nation and society by
laying strong theoretical foundation accompanied by wide practical training.
To equip the young women with creative thinking capabilities and empowering them towards
innovation.
iv
RISHI M.S INSTITUTE OF ENGINEERING & TECHNOLOGY FOR WOMEN
(Affiliated to JNTUH University, Approved by AICTE)
Department of Computer Science And Engineering & Information Technology
Adopting creative techniques to nurture and strengthen the core skill of Computer Science.
Introduce students to the most recent technological advancements.
Impart quality education, improve the research, entrepreneurial, and employability skills of women
technocrats.
Instil professional ethics and a sense of social responsibility in students.
Strengthen the Industry-Academia interface, which will enable graduates to emerge as
academic leaders or inspiring entrepreneurs
v
RISHI M.S INSTITUTE OF ENGINEERING & TECHNOLOGY FOR WOMEN
(Affiliated to JNTUH University, Approved by AICTE)
Department of Computer Science And Engineering & Information Technology
vi
RISHI M.S INSTITUTE OF ENGINEERING & TECHNOLOGY FOR WOMEN
(Affiliated to JNTUH University, Approved by AICTE)
Department of Computer Science And Engineering & Information Technology
PSO 1: Improve the student's ability to decipher the basic principles and methodology of computer
systems. Improve the students' ability to absorb facts and technical ideas in order to build and
develop software.
PSO 2: The capacity to create novel job routes as an entrepreneur using modern computer languages
and evolving technologies like SDLC, Python, Machine Learning, Social Networks, Cyber
Security, Mobile Apps etc.
vii
RISHI M.S INSTITUTE OF ENGINEERING & TECHNOLOGY FOR WOMEN
(Affiliated to JNTUH University, Approved by AICTE)
Department of Computer Science And Engineering & Information Technology
PEO-1: Engineering graduates with excellent fundamental and technical skills will have
successful careers in industry, meeting the needs of Indian and worldwide firms.
PEO-2: With determination, development, self-reliance, leadership, morality, and moral principles,
engineering graduates will become successful entrepreneurs who will leverage employability.
PEO-3: To support personal and organisational progress, engineering graduates will pursue higher
education and engage in lifelong learning.
viii
SYLLABUS
SCRIPTING LANGUAGES LAB
B.TECH III Year II Sem
Week -1:
1. Write a Ruby script to create a new string which is n copies of a given string where n is a non-
negative integer
2. Write a Ruby script which accept the radius of a circle from the user and compute the parameter and
area
3. Write a Ruby script which accept the users first and last name and print them in reverse order with a
space between them
Week - 2:
4. Write a Ruby script to accept a filename from the user print the extension of that
5. Write a Ruby script to find the greatest of three numbers
6. Write a Ruby script to print odd numbers from 10 to 1
Week - 3:
7. Write a Ruby script to check two integers and return true if one of them is 20 otherwise return their
sum
8. Write a Ruby script to check two temperatures and return true if one is less than 0 and the other is
greater than 100
9. Write a Ruby script to print the elements of a given array
Week - 4:
10. Write a Ruby program to retrieve the total marks where subject name and marks of a student stored in a hash
11. Write a TCL script to find the factorial of a number
12. Write a TCL script that multiplies the numbers from 1 to 10
Week - 5:
13. Write a TCL script for sorting a list using a comparison function
14. Write a TCL script to (i) create a list (ii) append elements to the list (iii) Traverse the list (iv)
Concatenate the list
15. Write a TCL script to comparing the file modified times.
Week - 6:
16. Write a TCL script to Copy a file and translate to native format.
17. a) Write a Perl script to find the largest number among three numbers. b) Write a Perl script to print the
multiplication tables from 1-10 using subroutines.
18. Write a Perl program to implement the following list of manipulating functions a) Shift b) Unshift c) Push
Week - 7:
19. a) Write a Perl script to substitute a word, with another word in a string. b) Write a Perl script to
validate IP address and email address.
20. Write a Perl script to print the file in reverse order using command line arguments
TEXT BOOKS:
1. The World of Scripting Languages, David Barron,Wiley Publications.
ix
2. Ruby Programming language by David Flanagan and Yukihiro Matsumoto O’Reilly
3. “Programming Ruby” The Pramatic Progammers guide by Dabve Thomas Second edition
REFERENCE BOOKS:
1. Open Source Web Development with LAMP using Linux Apache, MySQL, Perl and PHP, J.Lee and B. Ware
(Addison Wesley) Pearson Education.
2. Perl by Example, E. Quigley, Pearson Education.
3. Programming Perl, Larry Wall, T. Christiansen and J. Orwant, O’Reilly, SPD.
4. Tcl and the Tk Tool kit, Ousterhout, Pearson Education. 5. Perl Power, J. P. Flynt, Cengage Learning.
x
Course Objectives:
To Understand the concepts of scripting languages for developing web based projects
To understand the applications the of Ruby, TCL, Perl scripting languages
Course Outcomes:
Ability to understand the differences between Scripting languages and programming languages
Gain some fluency programming in Ruby, Perl, TCL
CO - PO MAPPING:
CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12
Python CO1 3 1 2 1 2 2
Programming
Lab CO2 1 2 3 2 1 3
CO3 3 2 3 1 3 3
CO - PSO MAPPING:
PSO-1 PSO-2
CO1 1 3
CO2 2 3
CO3 2 3
xi
WEEK-1
EXPERIMENT NO: 1.
Write a Ruby script to create a new string which is n copies of a given string where n is a non-negative
integer
Aim: Write a Ruby script to create a new string which is n copies of a given string where n is a
nonnegative integer
CODE:
def multiple_string(str, n)
return str*n
end
print multiple_string('a', 1),"\n"
print multiple_string('a', 2),"\n"
print multiple_string('a', 3),"\n"
print multiple_string('a', 4),"\n"
print multiple_string('a', 5),"\n"
Output:
a
aa
aaa
aaaa
aaaaa
i
EXPERIMENT NO: 2
Write a Ruby script which accept the radius of a circle from the user and compute the parameter and
area.
Aim: Write a Ruby script which accept the radius of a circle from the user and compute the parameter
and area.
CODE:
radius = 5.0
perimeter = 0.0
area = 0.0
print "Input the radius of the circle: "
radius = gets.to_f
perimeter = 2 * 3.141592653 * radius
area = 3.141592653 * radius * radius
puts "The perimeter is #{perimeter}."
puts "The area is #{area}."
Output:
Input the radius of the circle: The perimeter is 31.41592653.
The area is 78.539816325.
ii
EXPERIMENT NO: 3
Write a Ruby script which accept the user's first and last name and print them in reverse order with a
space between them
Aim: Write a Ruby script which accept the user's first and last name and print them in reverse order
with a space between them
CODE:
puts "Input your first name: "
fname = gets.chomp
puts "Input your last name: "
lname = gets.chomp
puts "Hello #{lname} #{fname}"
Output:
Input your first name:
Input your last name:
Hello Lanoie Gary
iii
WEEK-2
EXPERIMENT NO: 4 Write a Ruby script to accept a filename from the user print the extension of
that
Aim: Write a Ruby script to accept a filename from the user print the extension of that
Code:
file = "/user/system/test.rb"
# file name
fbname = File.basename file
puts "File name: "+fbname
# basename
bname = File.basename file,".rb"
puts "Base name: "+bname
# file extention
ffextn = File.extname file
puts "Extention: "+ffextn
# path name
path_name= File.dirname file
puts "Path name: "+path_name
Output:
File name: test.rb
Base name: test
Extention: .rb
Path name: /user/system
iv
EXPERIMENT NO: 5. Write a Ruby script to find the greatest of three numbers
Aim: Write a Ruby script to find the greatest of three numbers
Code:
x,y,z = 2,5,4
if x >= y and x >= z
puts "x = #{x} is greatest."
elsif y >= z and y >= x
puts "y = #{y} is greatest."
Else
puts "z = #{z} is greatest."
end
Copy
Output:
y = 5 is greatest.
v
EXPERIMENT NO: 6. Write a Ruby script to print odd numbers from 10 to 1.
Aim: Write a Ruby script to print odd numbers from 10 to 1.
Code:
puts "Odd numbers between 9 to 1: "
9.step 1, -2 do |x|
puts "#{x}"
end
Output:
Odd numbers between 9 to 1:
9
7
5
3
1
vi
WEEK-3
EXPERIMENT NO.: 7 Write a Ruby scirpt to check two integers and return true if one of
them is 20 otherwise return their sum.
AIM: Write a Ruby scirpt to check two integers and return true if one of them is 20 otherwise
return their sum.
Ruby Code:
def makes20(x,y)
return x == 20 || y == 20 || x + y == 20
end
print makes20(20, 10),"\n"
print makes20(40, 10),"\n"
print makes20(15, 20)
Copy
Output:
true
false
true
vii
EXPERIMENT NO.: 8 Write a Ruby script to check two temperatures and return true if one is
less than 0 and the other is greater than 100
AIM: Write a Ruby script to check two temperatures and return true if one is less than 0 and the
other is greater than 100
Ruby Code:
def temp(temp1, temp2)
return ( temp1 < 0 && temp2 > 100 ) || ( temp1 > 100 && temp2 < 0 );
end
print temp(110, -1),"\n"
print temp(-1, 110),"\n"
print temp(2, 120)
Output:
true
true
false
viii
EXPERIMENT NO.: 9 Write a Ruby script to print the elements of a given array
AIM: Write a Ruby script to print the elements of a given array
Sample array : ["Ruby", 2.3, Time.now]
Ruby Code:
array1 = ["Ruby", 2.3, Time.now]
for array_element in array1
puts array_element
end
Copy
Output:
Ruby
2.3
2017-12-28 06:01:53 +0000
ix
WEEK-4
x
EXPERIMENT NO.: 11
Write a TCL script to find the factorial of a number
AIM: Write a TCL script to find the factorial of a number
Code:
set counter 4
set factorial 1
while {$counter > 0} {
set factorial [expr $factorial * $counter]
incr counter -1
}
puts $factorial
Factorial 10
=> 3628800
xi
EXPERIMENT NO.: 12. Write a TCL script that multiplies the numbers from 1 to 10
AIM: Write a TCL script that multiplies the numbers from 1 to 10
<html>
<head>
<title>Simple JavaScript
Program</title>
</head>
<body>
<p id="output">0</p>
<button id="incre
III-II B-TECH CSE (AIML)
DEVOPS LAB MANUAL
EXPERIMENT NO.: 11. Write
a simple program in
JavaScript and
perform testing using Selenium
AIM: Write a simple program in
JavaScript and perform testing
using
Selenium xiii
PROGRAM:
Simple JavaScript program that
you can test using Selenium
<!DOCTYPE html>
<html>
<head>
<title>Simple JavaScript
Program</title>
</head>
<body>
<p id="output">0</p>
<button id="incre
III-II B-TECH CSE (AIML)
DEVOPS LAB MANUAL
EXPERIMENT NO.: 11. Write
a simple program in
JavaScript and
perform testing using Selenium
xiv
AIM: Write a simple program in
JavaScript and perform testing
using
Selenium
PROGRAM:
Simple JavaScript program that
you can test using Selenium
<!DOCTYPE html>
<html>
<head>
<title>Simple JavaScript
Program</title>
</head>
<body>
<p id="output">0</p>
<button id="incre
III-II B-TECH CSE (AIML)
DEVOPS LAB MANUAL
xv
EXPERIMENT NO.: 11. Write
a simple program in
JavaScript and
perform testing using Selenium
AIM: Write a simple program in
JavaScript and perform testing
using
Selenium
PROGRAM:
Simple JavaScript program that
you can test using Selenium
<!DOCTYPE html>
<html>
<head>
<title>Simple JavaScript
Program</title>
</head> xvi
<body>
<p id="output">0</p>
<button id="incre
III-II B-TECH CSE (AIML)
DEVOPS LAB MANUAL
EXPERIMENT NO.: 11. Write
a simple program in
JavaScript and
perform testing using Selenium
AIM: Write a simple program in
JavaScript and perform testing
using
Selenium
PROGRAM:
Simple JavaScript program that
you can test using Selenium
<!DOCTYPE html>
<html> xvii
<head>
<title>Simple JavaScript
Program</title>
</head>
<body>
<p id="output">0</p>
<button id="incre
III-II B-TECH CSE (AIML)
DEVOPS LAB MANUAL
EXPERIMENT NO.: 11. Write
a simple program in
JavaScript and
perform testing using Selenium
AIM: Write a simple program in
JavaScript and perform testing
using
Selenium
PROGRAM: xvii
i
Simple JavaScript program that
you can test using Selenium
<!DOCTYPE html>
<html>
<head>
<title>Simple JavaScript
Program</title>
</head>
<body>
<p id="output">0</p>
<button id="incre
PROGRAM:
Simple JavaScript program that
you can test using Selenium
<!DOCTYPE html>
<html>
<head>
<title>Simple JavaScript
xix
Program</title>
</head>
<body>
<p id="output">0</p>
Code:
set n 10
for {set i 1} {$i <= $n} {incr i}
{ puts $i }
Output
1
2
3
4
5
6
7
8
9
10
xx
WEEK-5
output
blue green orange red
xxi
EXPERIMENT NO.: 14.
Write a TCL script to
(i)create a list
(ii )append elements to the list
(iii)Traverse the list
(iv)Concatenate the list
AIM: Write a TCL script to
(i)create a list
(ii )append elements to the list
(iii)Traverse the list
(iv)Concatenate the list
PROGRAM:
Simple JavaScript program that
you can test using Selenium
<!DOCTYPE html>
<html>
<head>
<title>Simple JavaScript
Program</title>
</head>
<body>
<p id="output">0</p>
<button id="incre
III-II B-TECH CSE (AIML)
DEVOPS LAB MANUAL
EXPERIMENT NO.: 11. Write
a simple program in
JavaScript and
perform testing using Selenium
xxii
i
AIM: Write a simple program in
JavaScript and perform testing
using
Selenium
PROGRAM:
Simple JavaScript program that
you can test using Selenium
<!DOCTYPE html>
<html>
<head>
<title>Simple JavaScript
Program</title>
</head>
<body>
<p id="output">0</p>
<button id="incre
III-II B-TECH CSE (AIML)
DEVOPS LAB MANUAL
xxi
v
EXPERIMENT NO.: 11. Write
a simple program in
JavaScript and
perform testing using Selenium
AIM: Write a simple program in
JavaScript and perform testing
using
Selenium
PROGRAM:
Simple JavaScript program that
you can test using Selenium
<!DOCTYPE html>
<html>
<head>
<title>Simple JavaScript
Program</title>
</head> xxv
<body>
<p id="output">0</p>
<button id="incre
III-II B-TECH CSE (AIML)
DEVOPS LAB MANUAL
EXPERIMENT NO.: 11. Write
a simple program in
JavaScript and
perform testing using Selenium
AIM: Write a simple program in
JavaScript and perform testing
using
Selenium
PROGRAM:
Simple JavaScript program that
you can test using Selenium
<!DOCTYPE html>
<html> xxv
i
<head>
<title>Simple JavaScript
Program</title>
</head>
<body>
<p id="output">0</p>
<button id="incre
III-II B-TECH CSE (AIML)
DEVOPS LAB MANUAL
EXPERIMENT NO.: 11. Write
a simple program in
JavaScript and
perform testing using Selenium
AIM: Write a simple program in
JavaScript and perform testing
using
Selenium
PROGRAM: xxv
ii
Simple JavaScript program that
you can test using Selenium
<!DOCTYPE html>
<html>
<head>
<title>Simple JavaScript
Program</title>
</head>
<body>
<p id="output">0</p>
<button id="incre
III-II B-TECH CSE (AIML)
DEVOPS LAB MANUAL
EXPERIMENT NO.: 11. Write
a simple program in
JavaScript and
perform testing using Selenium
xxv
iii
AIM: Write a simple program in
JavaScript and perform testing
using
Selenium
PROGRAM:
Simple JavaScript program that
you can test using Selenium
<!DOCTYPE html>
<html>
<head>
<title>Simple JavaScript
Program</title>
</head>
<body>
<p id="output">0</p>
<button id="incre
PROGRAM:
xxi
x
Simple JavaScript program that
you can test using Selenium
<!DOCTYPE html>
<html>
<head>
<title>Simple JavaScript
Program</title>
</head>
<body>
<p id="output">0</p>
Code:
Creating a List
Some examples are given below –
set colorList1 {red green blue}
set colorList2 [list red green blue]
set colorList3 [split "red_green_blue" ]
puts $colorList1
puts $colorList2
puts $colorList3
result –
red green blue
red green blue
red green blue
Appending Item to a List
Some examples are given below – xxx
Traversing lists
For each item {1 2 3 4 5 6 7 8 9}
{ puts $item
}
result –
1
2
3
4
5
6
7
8
9
Concatenate the list
set i [concat {a b c} {1 2 3}]
puts $i
result − a b c 1 2 3
Output
1
2
3
4
5
6
7
8
9
10
xxx
i
EXPERIMENT NO.: 15.
Write a TCL script to comparing the file modified times.
AIM: Write a TCL script to comparing the file modified times.
PROGRAM:
proc newer { fp fp2 } {
if ![file exists $fp] {
puts "file exsist"
} else {
# Assume file1 exists
expr [file mtime $fp] > [file mtime $fp2]
puts "file modification times compared."
}
}
newer file1.txt file2.txt
xxx
ii
WEEK-6
EXPERIMENT NO.: 16.
Write a TCL script to Copy a file and translate to native format.
AIM: Write a TCL script to Copy a file and translate to native format.
PROGRAM:
proc File_Copy {src dest} {
if [file isdirectory $src] {
file mkdir $dest
foreach f [glob -nocomplain [file join $src *]] {
File_Copy $f [file join $dest [file tail $f]]
}
return
}
if [file isdirectory $dest] {
set dest [file join $dest [file tail $src]] }
set in [open $src]
set out [open $dest w]
puts -nonewline $out [read $in]
close $out ; close $in
}
xxx
iii
EXPERIMENT NO.: 17.
a) Write a Perl script to find the largest number among three numbers. Vi great.pl
AIM: Write a Perl script to find the largest number among three numbers. Vi great.pl
PROGRAM:
#!/usr/bin/perl
print "enter a value";
$a=; print "enter b value";
$b=; print "enter c value";
$c=; if($a > $b) //if compares string use gt ,lt,le,ge
{
if($a> $c)
{
print " $a is largest number\n";
}
else
{
print " $c is largest number\n"; }
}
elsif($b >$c)
{
print " $b is largest number";
}
Else
{
print " $c is largest nnumber";
}
xxx
iv
OUT PUT:
Perl great.pl
Enter a value 4
Enter b value 6
Enter c value 5
6 is largest number
b) Write a Perl script to print the multiplication tables from 1-10 using subroutines.
Program:
for($i=1;$i<=12;$i++)
{
$a[$i]=$i;
}
for($i=1;$i<=12;$i++)
{
for($j=1;$j<=12;$j++)
{
print(($a[$j]*$a[$i])," ");
}
print "\n\n";
}
Output:
1 2 3 4 5 6 7 8 9 10 11 12 2 4 6 8 10 12 14 16 18 20 22 24 3 6 9 12 15 18 21 24 27 30 33 36 4 8
12 16 20 24 28 32 36 40 44 48 5 10 15 20 25 30 35 40 45 50 55 60 6 12 18 24 30 36 42 48 54
60 66 72 7 14 21 28 35 42 49 56 63 70 77 84 8 16 24 32 40 48 56 64 72 80 88 96 9 18 27 36 45
54 63 72 81 90 99 108 10 20 30 40 50 60 70 80 90 100 110 120 11 22 33 44 55 66 77 88 99 110
121 132 12 24 36 48 60 72 84 96 108 120 132 144
xxx
v
EXPERIMENT NO.: 18.
Write a Perl program to implement the following list of manipulating functions
a)Shift
b)Unshift
c)Push
Perl provides various inbuilt functions to add and remove the elements in an array.
Functio
N Description
Push Inserts values of the list at the end of an array
Pop Removes the last value of an array shift
Shifts all the values of an array on its left
unshift Adds the list element to the front of an array
push function This function inserts the values given in the list at an end of an array
Multiple values can be inserted separated by comma.
This function increases the size of an array. It returns number of elements in new array.
xxx
vi
Output: Original array: Java C C++ Updated array: Java C C++ Python Perl
pop function
This function is used to remove the last element of the array. After executing the pop function, size of
the array is decremented by one element. This function returns undef if list is empty otherwise returns
the last element of the array.
Syntax: pop(Array)
Example:
Perl
#!/usr/bin/perl
# Initializing the array @x = ('Java', 'C', 'C++');
# Print the Initial array print "Original array: @x \n";
# Prints the value returned by pop print "Value returned by pop: ", pop(@x);
# Prints the array after pop operation print "\nUpdated array: @x";
Output:
Original array: Java C C++
Value returned by pop: C++
Updated array: Java C
xxx
vii
shift function
This function returns the first value in an array, removing it and shifting the elements of the array list to
the left by one. Shift operation removes the value like pop but is taken from the start of the array
instead of the end as in pop. This function returns undef if the array is empty otherwise returns first
element of the array.
Syntax: shift(Array)
Example:
Perl
#!/usr/bin/perl
# Initializing the array @x = ('Java', 'C', 'C++');
# Print the Initial array print "Original array: @x \n";
# Prints the value returned
# by shift function print "Value returned by shift: ", shift(@x
# Array after shift operation print "\nUpdated array: @x";
Output:
Original array: Java C C++
Value returned by shift :Java
Updated array: C C++
xxx
viii
unshift function
This function places the given list of elements at the beginning of an array. Thereby shifting all the
values in an array by right. Multiple values can be unshift using this operation. This function returns the
number of new elements in an array.
Output:
Original array: Java C C++
No of elements returned by unshift :5
Updated array: PHP JSP Java C C++
xxx
ix
WEEK-6
Output:
GeekstoGeeks
xl
b) Write a Perl script to validate IP address and email address.
#!/usr/bin/perl print("Enter the IP Address you would like to validate - ");
my $ip = ;
if($ip =~ /(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/)
{
$ip = $1;
}
chomp($ip); if($ip =~ m/^(\d\d?\d?)\.(\d\d?\d?)\.(\d\d?\d?)\.(\d\d?\d?)$/)
{
print("\nIP address found - $ip\n");
if($1 <= 255 && $2 <= 255 && $3 <= 255 && $4 <= 255)
{
print("Each octet of an IP address is ", "within the range - $1.$2.$3.$4\n");
print("\n-> $ip IP address accepted!\n"); }
else
{
print("Octet(s) out of range. ", "Valid number range between 0-255\n"); }
}
Else
{
print("IP Address $ip is not in a valid format\n");
}
xli
EXPERIMENT NO.: 20.
Write a Perl script to print the file in reverse order using command line arguments
AIM: Write a Perl script to print the file in reverse order using command line arguments
PROGRAM:
@lines = <>;
print reverse @lines;
output
1
2
3
4
5
Reverse
5
4
3
2
1
xlii
xliii