How many type of variable in Perl?
Perl has three built in variable types
What is the different between array and hash in Perl?
Array is an order list of values position by index.
Hash is an un-ordered list of values position by keys.
What is the difference between a list and an array?
A list is a fixed collection of scalars.
An array is a variable that holds a variable collection of scalars.
What is a subroutine?
A subroutine is like a function called upon to execute a task.
subroutine is a reusable piece of code.
what does this mean ‘$^0’? tell briefly
$^ – Holds the name of the default heading format for the default file handle. Normally, it is equal to the file handle’s name with _TOP appended to it.
What is the difference between die and exit in Perl?
1) die is used to throw an exception
exit is used to exit the process.
2) die will set the error code based on $! or $? if the exception is uncaught.
exit will set the error code based on its argument.
3) die outputs a message
exit does not.
Adding and Removing Elements in Array?
Use the following functions to add/remove and elements:
push(): adds an element to the end of an array.
unshift(): adds an element to the beginning of an array.
pop(): removes the last element of an array.
shift() : removes the first element of an array.
PERL Conditional Statements?
The conditional statements are if and unless
What are Perl supports four main loop types?
While, for, until, for each.
Are you Looking for Perl Scripting Online Training? Please Enroll for Demo Perl Scripting..!
Explain tell Function?
The first requirement is to find your position within a file, which you do using the tell function:
Perl Regular Expression?
A regular expression is a string of characters that define the pattern
There are three regular expression operators within Perl
Match Regular Expression – m//
Substitute Regular Expression – s///
Transliterate Regular Expression – tr///
What is the difference between chop & chomp functions in Perl?
chop is used remove last character, chomp function removes only line endings.
Define Perl Scripting?
In the IT market, Perl scripting is considered as a robust scripting language which is used in various fields. Perl is good at obtaining Regular expressions and in all the fields of application it is unique. Perl is a scripting language which is based on interpreter but not on the languages based on compiler. In all the applications, optimization is used.
Why To Use Perl Scripting?
Perl scripting is mainly used in functional concepts as well as regular expressions, you can also design own policies to obtain generalized pattern using regular expression. Perl is compatible or supports more than 76 operating systems and 3000 modules and it is known as Comprehensive Perl Archive Network modules.
What Is Perl?
Perl is a programming language which is based on shell, C, Lisp, etc. In general, Perl is mainly used for network operations, OS program and for developing some websites.
Why To Use Perl?
• It is a powerful interpreter for free.
• Perl is flexible and portable. It is very easy to learn Perl language.
Which Is Your Favorite Module And Why It Is?
CGI.pm is my favorite module and it handles several tasks such as printing the headers, parsing the form input and it handles sessions and cookies effectively.
What Happens If A Reference Is Returned To Private Variable?
Your variables are kept on track by the Perl, whether dynamic or else, and does not free things before you use them.
What Are The Two Different Types Of Data Perl Handles?
Perl handles two types of data they are
(i) Scalar Variables and
Scalar variables hold a single data item whereas lists hold multiple data items.
What Are Scalar Variables?
Scalar variables are what many programming languages refer to as simple variables. They hold a single data item, a number, a string, or a perl reference. Scalars are called scalars to differentiate them from constructs that can hold more than one item, like arrays.
Explain About Lists?
A list is a construct that associates data elements together and you can specify a list by enclosing those elements in parenthesis and separating them with commas. They could themselves be arrays, hashes or even other lists. Lists do not have a specific list data type.
What Is A Short Circuit Operator?
The C-Style operator, ll, performs a logical (or) operation and you can use it to tie logical clauses together, returning an overall value of true if either clause is true. This operator is called a short-circuit operator because if the left operand is true the right operand is not checked or evaluated.
How We Can Navigate The Xml Documents?
You can use SAX if what you require is simple accessing of the xml structure. You can go for DOM if you need node handling capabilities like inserting a node, modifying a node, deleting node and stuff like that.
Help In Perl?
perldoc -f print
What Is The Use Of “stderr()”?
The special filehandle for standard error in any package.
Advantages Of C Over Perl?
In reality PERL interpreter is written in C. So what all advantages C have are also possessed by PERL. Otherwise C is faster than PERL, because PERL is an interpreted language.