1) What is Perl?
It is a programming language which is used for web development, system administration, GUI development and etc.
It is also known as cross-platform programming language.
2) What are the Features of Perl?
The features of Perl are:
- Simple object oriented programming syntax
- Easily extendible
- Open source modules
- Supports third party databases
- Cross platform language
- Embeddable in other systems
3) What are the types of data types used in Perl?
The types of data types used in Perl are:
4) What are the types of "Perl Operators"?
The types of Perl operators are:
- String operators
- Bitwise operators
- Assignment operators
- Numeric operators
- Special operators
- Comparison operators
- Logical operators
5) What are types of Perl variables?
The variables used in Perl are:
6) How many loop control keywords are there in Perl?
The loop control keywords in Perl are:
7) What are array functions in Perl?
It is used to add or remove some elements in an array.
Four types of Perl array functions are:
8) Write a simple program in Perl to print "PERL EXPERT"?
Example
9) What will be the output of the following code snippet?
for ($count = 10; $count >= 1; $count--)
{
print "$count ";
}
OUTPUT: 10 9 8 7 6 5 4 3 2 1
10) Write a program in Perl to check the number is Even or Odd?
Example:
print "Enter a Number:\n";
$num = <>;
if( $num %2==0 ){
printf "Even Number\n";
}else{
printf "Odd Number\n";
}
11) What will be the output of the following code snippet?
use strict;
use warnings;
my $x = "Jaiswal";
$y::x = "Atul";
print "$y::x\n";
print "$x\n";
OUTPUT: Atul Jaiswal
12) What is the use of the –w switch in Perl?
It is used to produce extra warning messages in Perl.
13) What are the types of Scalar functions used in Perl?
The types of Scalar Functions used in Perl are:
- Defined
- Undef
- Ref
- Reverse
- Chomp
- Chop
- Index
- Return
14) What are the types of Hash functions used in Perl?
The types of Hash Functions used in Perl are:
- Exists
- Delete
- Sort
- Values
- Keys
- Each
- Hash length
- Context
15) What will be the output of the following code snippet?
$a = 5;
while($a < 150)
{
if( $a == 40 )
{
$a = $a + 10;
redo;
}
print "a = $a\n";
}
continue
{
$a = $a * 2;
}
OUTPUT:
a = 5
a = 10
a = 20
a = 50
a = 100
16) Who is the developer of Perl programming language?
Larry Wall is the developer of Perl programming language.
17) What is the file extension of Perl programming language?
.pl or .PL is the file extension of Perl programming language.
18) What are Hashes in Perl?
Hashes: They are unordered set of key and value pairs that you access using the keys as subscripts.
Hashes are denoted by a percent (%) sign.
19) What is the use of sort() function in Perl?
sort() function: This function is used to sorts each element of an array according to the ASCII Numeric standards.
20) What is the full form of GMT?
GMT stands for
Greenwich
Mean
Time.
21) What is the use of localtime() in Perl?
localtime(): It is a function which returns values for the current date and time if given no arguments.
22) What is the difference between gmtime() and localtime() functions?
gmtime() function: This function works similar to the localtime() function. gmtime() function return the universal Greenwich Mean Time (GMT).
localtime() function: This function return the current local time on the machine.
23) What is Dereferencing in Perl?
Dereferencing: It returns the value from a reference point to the location. To dereference a reference, you can use $, @ or % as prefix of the reference variable.
24) Which feature of Perl provides code reusability?
Inheritance feature of Perl provides code reusability.
25) Can we load binary extension dynamically in Perl?
Yes, we can load binary extension dynamically in Perl.
26) What is the syntax to add two arrays together in Perl?
The syntax to add two arrays together in Perl is:
@arrayvar = (@array1,@array2);
27) What is the syntax of grep function in Perl?
The syntax of grep function in Perl is:
- grep BLOCK LIST
- grep (EXPR, LIST)
28) Why Perl aliases are considered to be faster than references?
Perl aliases are faster than references because they do not require any dereferencing.
29) What are the prefix dereference available in Perl?
The prefix dereference available in Perl are:
@: denotes arrays
&: denotes subroutine
%: denotes Hash variables
$: denotes Scalar variables
30) Which keyword is used to call a subroutine?
&myvariable is used to call a subroutine.