Top 50 Perl Scripting Interview Questions
Q1. What Is Obp And How Do You Access It?
OBP is known as as Open Boot PROM. This OBP can be accessiable thru ok> prompt
Q2. Write A Script To Reverse A String Without Using Perl's Built In Functions?
My $txt = 'Hello World';
my $len= duration($txt);
my $rev;
at the same time as($len > zero)
$len--;
$rev .= substr($txt,$len,1);
print $txt, ' - Reversed = ' , $rev;
Q3. Which Of These Is A Difference Between C++ And Perl?
Perl could have objects whose facts cannot be accessed outdoor its magnificence, however C++ cannot.
Perl can use closures with unreachable non-public information as gadgets, and C++ does not support closures. Furthermore, C++ does assist pointer arithmetic through `int *ip = (int*)&object', permitting you do look all around the object. Perl doesn't have pointer mathematics. It also would not allow `#define non-public public' to exchange access rights to overseas gadgets. On the other hand, when you start poking around in /dev/mem, nobody is safe.
Q4. What Is Hash?
Hash is an associative array where records is stored in
"key"->"cost" pairs.
Eg : end result is a hash having their names and charge
%fruits = ("Apple", "60", "Banana", "20", "Peers", "forty");
Q5. Is There Any Way To Add Two Arrays Together?
Of direction you can upload two arrays together with the aid of the use of push characteristic. The push feature provides a fee or values to the end of an array. The push feature pushes the values of listing onto the give up of the array. Length of an array can be multiplied by using the period of list.
Q6. What Are Scalar Data And Scalar Variables?
Perl has a flexible concept of statistics types. Scalar me a unmarried element, like a number or string. So the Java idea of int, waft, double and string equals to Perl's scalar in idea and the numbers and strings are exchangeable. Scalar variable is a Perl variable that is used to keep scalar records. It makes use of a dollar sign $ and followed by one or extra aphanumeric characters or underscores. It is case sensitive.
Q7. How To Concatinate Strings In Perl?
Through . Operator
Q8. Advantages Of C Over Perl?
In truth PERL interpreter is written in C. So what all benefits C have are also possesed by means of PERL. Otherwise C is quicker than PERL, because PERL is an interpreted language.
Q9. What Is A Regular Expression?
It defines a sample for a search to healthy.
Q10. How To Connect With Sqlserver From Perl And How To Display Database Table Info?
There is a module in perl named DBI - Database independent interface in an effort to be used to hook up with any database by way of the use of equal code. Along with DBI we ought to use database specific module here it's miles SQL server. For MSaccess it is DBD::ODBC, for MySQL it is DBD::mysql motive force, for integrating oracle with perl use DBD::oracle driving force is used. IIy for SQL server there are available many custom described ppm( perl package deal supervisor) like Win32::ODBC, mssql::oleDB and so forth.So, collectively with DBI, mssql::oleDB we are able to get admission to SQL server database from perl. The instructions to get admission to database is equal for any database.
Q11. How To Code In Perl To Implement The Tail Function In Unix?
You need to keep a shape to store the line wide variety and the dimensions of the record at that point eg. 1-10bytes, 2-18bytes.. You have a counter to growth the range of traces to find out the number of traces in the file. After you are through the report, you'll realize the dimensions of the report at any nth line, use 'sysseek' to transport the document pointer again to that role (closing 10) and then start studying till the give up.
Q12. How Do You Open A File For Writing?
Open FILEHANDLE, ">$FILENAME"
Q13. What Is The Tk Module?
It gives a GUI interface.
Q14. What Does This Mean :
'$_' ?
Default variable in Perl.
Its an Default variable in Perl, in which the input from the consumer can be taken into this variable if the variable isn't described by using the user.
Q15. What Does Init 5 And Init zero Do?
Init five will shutdown and Power-off the server.
Init 0 will carry the server to the ok> set off (Fourth reveal)
Q16. What Is Perl?
Perl is a programming language that's based totally on shell, C, Lisp, and so on. In standard, Perl is in particular used for community operations, OS software and for developing some web sites.
Q17. How Do You Boot From Cd-rom?
Booting shape CD-ROM can be done by using the command
good enough >boot cdrom
Q18. What Is Cpan ? What Are The Modules Coming Under This?
CPAN is Comprehensive Perl Archive Network. It’s a repository consists of lots of Perl modules, source and documentation, and all beneath GNU/GPL or similar license. Some Linux distributions offer a device named "cpan" with which you could deploy applications directly from CPAN
Q19. What Is Vts?
Sun Validation Test Suite -> assessments and validates Sun hardware by way of verifying the configuration and functionality of hardware controllers, gadgets
Q20. What Package You Use To Create A Windows Services?
Use Win32::OLE.
Q21. Why To Use Perl Scripting?
Perl scripting is specially utilized in functional ideas as well as ordinary expressions, you may also design personal rules to gain generalized sample the use of normal expression. Perl is well suited or helps more than seventy six running systems and 3000 modules and it's far referred to as Comprehensive Perl Archive Network modules.
Q22. What Value Is Returned By A Lone Return; Statement?
The undefined value in scalar context, and the empty listing value () in listing context. This way functions that desire to return failure can just use a simple go back with out stressful approximately the context wherein they have been called.
Q23. What Is Grep Used For In Perl?
Grep is used with regular expression to check if a parituclar fee exist in an array. It returns 0 if the price does now not exists, 1 in any other case.
Q24. Distinguish My And Local?
The variables which are declared using “my” lives best in that unique block ion which they're declared and inherited functions do now not have a visibility which are referred to as in that block. The variables which can be described as “neighborhood” are visible in that block and that they have a visibility in features that are known as in that specific block.
Q25. Can You Add Two Arrays Together?
Yes, it's far viable to feature arrays together with a push characteristic. A price or values to end of the array is introduced the use of push function. The values of list are pushed directly to the give up of an array using push feature. Length of list is used to boom period of an array.
Q26. Why To Use Perl?
• It is a powerful interpreter for free.
• Perl is bendy and transportable. It is very easy to learn Perl language.
Q27. What Is Perl Scripting?
Perl Scripting is one of the robust scripting languages inside the IT marketplace that's being utilized in “n” of fields. Perl is rich in finding Regular expressions and stands particular in all fields of application.
PERL is a scripting language. Since all scripting languages are interpreter primarily based languages however not compiler primarily based languages, we use for optimization of code in all utility.
Q28. How To Create A Package?
Pkgmk -o -r / -d /tmp -f Prototype
Q29. What Does This Symbol Mean '->'?
In Perl it is an infix dereference operator. For array subscript, or a hash key, or a subroutine, then this must be a reference. Also can be used as approach invocation.
Q30. How We Can Navigate The Xml Documents?
You can use SAX if what you require is easy accesing of the xml shape. You can move for DOM in case you need node managing talents like inserting a node, enhancing a node, deleteing node and stuff like that.
Q31. What Is Meant By Splicing Arrays Explain In Context Of List And Scalar.
Splicing an array me adding factors from a listing to that array, probable replacing elements now within the array. In list context, the splice function returns the factors removed from the array. In scalar context, the splice function returns the ultimate element removed.
Q32. What Does Perl Do If You Try To Exploit The Execve(2) Race Involving Setuid Scripts?
Sends mail to root and exits. It has been said that every one packages strengthen to the factor of being able to automatically study mail. While now not quite at that point (well, while not having a module loaded), Perl does at the least mechanically send it.
Q33. Which Has Highest Precedence In Between List And Terms? Explain?
In Perl, the best priority is for Perl. Quotes, variables, expressions in parenthesis are covered inside the Terms. The same degree of priority as Terms is for List operators. Especially, these operators have strong left word precedence.
Q34. How To Start Perl In Interactive Mode?
Perl -e -d 1 PerlConsole.
Q35. Differentiate Use And Require?
Use:
This method is used for modules.
The gadgets which can be blanketed are numerous at compilation time.
You want not deliver a file extension.
Require:
This technique is used for both modules and libraries.
The objects are protected are validated at run time.
You want now not give document extension.
Q36. What Is It Meants By '$_'?
It's far a default variable which holds robotically, a listing of arguements exceeded to the subroutine within parenthesis.
Q37. Why -w Argument Is Used With Perl Programs?
-w choice of the interpreter is used by most of the Perl builders mainly within the development stage of an software. It is warning option to turn on more than one caution messages which might be useful in information and debugging the utility.
Q38. Perl Regular Expressions Are Greedy" What Does This Mean?
Perl ordinary expressions commonly match the longest string feasible. That's what is known as as "greedy healthy"
Q39. How Do You Connect To Database In Perl
There is DBI module. Use DBI;my $dbh = DBI->join('dbi:Oracle:orcl', 'username', 'password',)in which username and password is yours. This is instance for oracle database.
For Sybase:
use DBI;
my $dbh = DBI->join('dbi:Sybase:server=$SERVER', 'username', 'password')
Q40. What Is The Use Of "stderr()"?
STDERR:
The unique filehandle for trendy mistakes in any package deal.
Q41. What Is The Difference Between Exec And System?
Exec runs the given system, switches to its call and in no way returns even as device forks off the given method, waits for its to complete after which return.
Q42. Define Perl Scripting?
In the IT market, Perl scripting is considered as a robust scripting language which is utilized in diverse fields. Perl is good at obtaining Regular expressions and in all the fields of utility it's far specific. Perl is a scripting language which is based on interpreter but now not at the languages based totally on compiler. In all the packages, optimization is used.
Q43. Help In Perl?
Perldoc -f print
Q44. How To Concatenate Strings With Perl?
Method #1 - using Perl's dot operator:
$call = 'checkbook';
$filename = "/tmp/" . $name . ".Tmp";
Method #2 - using Perl's be part of function
$call = "checkbook";
$filename = be a part of "", "/tmp/", $call, ".Tmp";
Method #three - usual manner of concatenating strings
$filename = "/tmp/$name.Tmp";
Q45. What Does Ndd Do?
Ndd command will hardcore the rate of the network interface card.
Q46. List The Files In Current Directory Sorted By Size ?
- ls -l sort -nr
Q47. How Do Find The Length Of An Array?
$@array
Q48. What Are The Different Types Of Perl Operators?
There are 4 different types of perl operators they're
(i) Unary operator just like the no longer operator
(ii) Binary operator like the addition operator
(iii) Tertiary operator like the conditional operator
(iv) List operator just like the print operator
Q49. How Do You View Shared Memory Statistics?
Change -l -> presentations swap usage
prstat -> examines all active approaches at the device and reviews information based
on the chosen output mode and type order
vmstat -> reviews information approximately techniques, reminiscence, paging, block IO, traps,
and cpu pastime
pmap -> lists the digital memory mappings underlying the given method
Q50. What Are The Arguements We Normally Use For Perl Interpreter
-e for Execute, -c to collect, -d to name the debugger at the file certain, -T for traint mode for protection/input checking -W for show all caution mode (or -w to reveal much less caution)

