CoolInterview.com - World's Largest Collection of Interview Questions & Answers, FAQs, queries, sample papers, exam papers, dumps, what, why, how, where, when questions
Our Services
Get 9,000 Interview Questions & Answers in an eBook.




Get it now !!
Send your Resume to 6000 Companies
Perl Interview Questions & Answers - Learning Mode
COOLINTERVIEW.COM PROGRAMMING LANGUAGES INTERVIEW QUESTIONS PERL INTERVIEW QUESTIONS QUESTIONS & ANSWERS - LEARNING MODE

Perl Interview Questions & Answers - Learning Mode

Perl is a script programming language that is similar in syntax to the C language and that includes a number of popular UNIX facilities such as sed, awk, and tr. Perl is an interpreted language that can optionally be compiled just before execution into either C code or cross-platform bytecode. Perl is a general-purpose programming language originally developed for text manipulation and now used for a wide range of tasks including system administration, web development, network programming, GUI development, and more.

Try Perl Interview Questions & Answers - Exam Mode

1 2 3 4 Next

Sort By : Latest First | Oldest First | By Rating

Perl Interview Questions & Answers - Learning Mode
Try Perl Interview Questions & Answers - Exam Mode
Question: What does new $cur->{LINK} do?

Answer: $cur->new()->{LINK}
The indirect object syntax only has a single token lookahead. That means if new() is a method, it only grabs the very next token, not the entire following expression.
This is why `new $obj[23] arg' does't work, as well as why `print $fh[23] "stuff "' does't work. Mixing notations between the OO and IO notations is perilous. If you always use arrow syntax for method calls, and nothing else, you'll not be surprised. Source: CoolInterview.com
Question: What is a subroutine?



Answer: A subroutine is like a function ... called upon to excecute a task. Source: CoolInterview.com
Question: How do I set environment variables in Perl programs?

Answer: As you may remember, "%ENV" is a special hash in Perl that contains the value of all your environment variables.
Because %ENV is a hash, you can set environment variables just as you'd set the value of any Perl hash variable. Here's how you can set your PATH variable to make sure the following four directories are in your path::

$ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin:/home/yourname/bin'; Source: CoolInterview.com
Question: What is meant by 'chomp'? where do we require this ?



Answer: chomp is used to eliminate the new line character. It can used in many different scenarios.<br><br>For ex: excuteScript.pl firstArgument.<br><br>$firstArg = $ARGV[0];<br><br>chomp $firstArg; --> to get rid of the carrige return.<br> Source: CoolInterview.com
Question: How does a ?grep? function perform?

Answer: Grep returns the number of lines the expression is true. Grep returns a sublist of a list for which a specific criterion is true. This function often involves pattern matching. It modifies the elements in the original list. Source: CoolInterview.com
Question: How many ways can we express string in Perl?

Answer: For example 'this is a string' can be expressed in:
"this is a string"
qq/this is a string like double-quoted string/
qq^this is a string like double-quoted string^
q/this is a string/
q&this is a string&
q(this is a string) Source: CoolInterview.com
Question: What value is returned by a lone return; statement?

Answer: The undefined value in scalar context, and the empty list value () in list context.
This way functions that wish to return failure can just use a simple return without worrying about the context in which they were called. Source: CoolInterview.com
Question: What are the different forms of goto in perl? Explain?

Answer: The three forms of goto are as follows. They are
(i) Goto label
(ii) Goto name
(iii) Goto expr
The first form, goto LABEL, transfers execution to the statement labeled LABEL. The second form, goto EXPR, expects EXPR to evaluate to a label. The last form goto &name is used with subroutines. This goto statement is used only when there is a necessity as it can create havoc in a program Source: CoolInterview.com
Question: What is meant by a 'pack' in perl?



Answer: Pack Converts a list into a binary representation<br><br>Takes an array or list of values and packs it into a binary structure, returning the string containing the structure<br><br>Hope that kills the problem !! <br><br> <br> Source: CoolInterview.com
Question: How do you match one letter in the current locale?

Answer: /[^W_d]/
We don't have full POSIX regexps, so you can't get at the isalpha() <ctype.h> macro save indirectly. You ask for one byte which is neither a non-alphanumunder, nor an under, nor a numeric. That leaves just the alphas, which is what you want. Source: CoolInterview.com
Question: What is a short circuit operator?

Answer: 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. Source: CoolInterview.com
Question: what does this mean :
'$_' ?



Answer: Default variable in Perl.

Source: CoolInterview.com
Question: "perl regular expressions are greedy" what does this mean?



Answer: Perl regular expressions normally match the longest string possible. that is what is called as "greedy match" For instance:my($text) = "mississippi";$text =~ m/(i.*s)/;print $1 . " ";Run the preceding code, and here's what you get:ississIt matches the first i, the last s, and everything in between them. But what if you want to match the first i to the s most closely following it? Use this code:my($text) = "mississippi";$text =~ m/(i.*?s)/;print $1 . " ";Now look what the code produces:is Source: CoolInterview.com
Question: What are the different types of eval statements?

Answer: There are two different types of eval statements they are eval EXPR and eval BLOCK. Eval EXPR executes an expression and eval BLOCK executes BLOCK. Eval Block executes an entire block, BLOCK. First one is used when you want your code passed in the expression and the second one is used to parse the code in the block. Source: CoolInterview.com
Question: What are scalar variables?

Answer: 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. Source: CoolInterview.com
Question: When would `local $_' in a function ruin your day?

Answer: When your caller was in the middle for a while(m//g) loop
The /g state on a global variable is not protected by running local on it. That'll teach you to stop using locals. Too bad $_ can't be the target of a my() -- yet. Source: CoolInterview.com
Question: What is the easiest way to download the contents of a URL with Perl?

Answer: Once you have the libwww-perl library, LWP.pm installed, the code is this:
#!/usr/bin/perl
use LWP::Simple;
$url = get 'http://www.websitename.com/'; Source: CoolInterview.com
Question: What happens to objects lost in "unreachable" memory..... ?

Answer: What happens to objects lost in "unreachable" memory, such as the object returned by Ob->new() in `{ my $ap; $ap = [ Ob->new(), $ap ]; }' ?

Their destructors are called when that interpreter thread shuts down.
When the interpreter exits, it first does an exhaustive search looking for anything that it allocated. This allows Perl to be used in embedded and multithreaded applications safely, and furthermore guarantees correctness of object code. Source: CoolInterview.com
Question: What is hash in perl?



Answer: Hash in basically used to comment the script line.
Source: CoolInterview.com
Question: What are the different types of perl operators?

Answer: There are four different types of perl operators they are
(i) Unary operator like the not operator
(ii) Binary operator like the addition operator
(iii) Tertiary operator like the conditional operator
(iv) List operator like the print operator Source: CoolInterview.com

1 2 3 4 Next



India News Network
Latest 20 Questions
Payment of time- barred debt is: (a) Valid (b) Void (c) Illegal (d) Voidable
Consideration is defined in the Indian Contract Act,1872 in: (a) Section 2(f) (b) Section 2(e) (c) Section 2(g) (d) Section 2(d)
Which of the following is not an exception to the rule, "No consideration, No contract": (a) Natural love and affection (b) Compensation for involuntary services (c) Completed gift (d) Agency
Consideration must move at the desire of: (a) The promisor (b) The promisee (c) The promisor or any other party (d) Both the promisor and the promisee
An offer which is open for acceptance over a period of time is: (a) Cross Offer (b) Counter Offer (c) Standing Offer (d) Implied Offer
Specific offer can be communicated to__________ (a) All the parties of contract (b) General public in universe (c) Specific person (d) None of the above
_________ amounts to rejection of the original offer. (a) Cross offer (b) Special offer (c) Standing offer (d) Counter offer
A advertises to sell his old car by advertising in a newspaper. This offer is caleed: (a) General Offer (b) Special Offer (c) Continuing Offer (d) None of the above
In case a counter offer is made, the original offer stands: (a) Rejected (b) Accepted automatically (c) Accepted subject to certain modifications and variations (d) None of the above
In case of unenforceable contract having some technical defect, parties (a) Can sue upon it (b) Cannot sue upon it (c) Should consider it to be illegal (d) None of the above
If entire specified goods is perished before entering into contract of sale, the contract is (a) Valid (b) Void (c) Voidable (d) Cancelled
______________ contracts are also caled contracts with executed consideration. (a) Unilateral (b) Completed (c) Bilateral (d) Executory
A offers B to supply books @ Rs 100 each but B accepts the same with condition of 10% discount. This is a case of (a) Counter Offer (b) Cross Offer (c) Specific Offer (d) General Offer
_____________ is a game of chance. (a) Conditional Contract (b) Contingent Contract (c) Wagering Contract (d) Quasi Contract
There is no binding contract in case of _______ as one's offer cannot be constructed as acceptance (a) Cross Offer (b) Standing Offer (c) Counter Offer (d) Special Offer
An offer is made with an intention to have negotiation from other party. This type of offer is: (a) Invitation to offer (b) Valid offer (c) Voidable (d) None of the above
When an offer is made to the world at large, it is ____________ offer. (a) Counter (b) Special (c) General (d) None of the above
Implied contract even if not in writing or express words is perfectly _______________ if all the conditions are satisfied:- (a) Void (b) Voidable (c) Valid (d) Illegal
A specific offer can be accepted by ___________. (a) Any person (b) Any friend to offeror (c) The person to whom it is made (d) Any friend of offeree
An agreement toput a fire on a person's car is a ______: (a) Legal (b) Voidable (c) Valid (d) Illegal
Cache = 0.054688 Seconds