Perl Scripting Interview Questions & Answers

5 avg. rating (100% score) - 1 votes

Perl Scripting Interview Questions & Answers

Are you person with computer knowledge? Do you have sound knowledge in programming languages? Are you capable enough to work as a programmer? Do you have extended knowledge in Perl scripting? Then browse through wisdom jobs online site. Perl scripting is a general-purpose programming language originally developed for text manipulation and is used for a wide range of tasks including system administration, web development, network programming, GUI and many more. As a programmer one need to possess good programming skills, and good communication skills. So, all the job seeking candidates enhance your skills and knowledge by looking into Perl scripting job interview questions and answers offered here and get selected as a manual test engineer, Perl scripting developer, soft ware engineer, Full stack developers, etc.

Perl Scripting Interview Questions

Perl Scripting Interview Questions
    1. Question 1. Define Perl Scripting?

      Answer :

      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.

    2. Question 2. Why To Use Perl Scripting?

      Answer :

      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.

    3. Question 3. What Is Perl?

      Answer :

      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.

    4. Question 4. Why To Use Perl?

      Answer :

      • It is a powerful interpreter for free.
      • Perl is flexible and portable. It is very easy to learn Perl language.

    5. Question 5. Why Do You Create An Application For Real Time System In Which Processing Speed Is Vital?

      Answer :

      Perl is used in the following cases:
      • To process large text
      • When data manipulation is done by application
      • If you require fast developments expand to become libraries
      • To load database operations

    6. Question 6. Which Is Your Favorite Module And Why It Is?

      Answer :

      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.

    7. Question 7. How Perl Warnings Are Turn On And Why Is It Important?

      Answer :

      In general, Perl excuse strange and also wrong code sometimes. Thus, the time spent for searching weird results and bugs in very high. You can identify common mistakes and strange places in the code easily when warnings are turned on. In the long run, the time required for debugging is saved a lot. There are numerous ways to turn on the warnings of Perl:

      • -w option is used on the command line for Perl one-liner
      • -w option on shebang line is used on windows or UNIX. Windows Perl interpreter do not require it.
      • For other systems, compiler documentation is checked or compiler warnings are selected.

    8. Question 8. Differentiate Use And Require?

      Answer :

      Use:

      • This method is used for modules.
      • The objects which are included are varied at compilation time.
      • You need not give a file extension.

      Require:

      • This method is used for both modules and libraries.
      • The objects are included are verified at run time.
      • You need not give file extension.

    9. Question 9. Distinguish My And Local?

      Answer :

      The variables which are declared using “my” lives only in that particular block ion which they are declared and inherited functions do not have a visibility that are called in that block. The variables which are defined as “local” are visible in that block and they have a visibility in functions which are called in that particular block.

    10. Question 10. Why Perl Patterns Are Not Regular Expressions?

      Answer :

      Perl patterns have back references
      By the definition, a regular expression should determine next state infinite automation without extra money to keep in previous state. State machine is required by the pattern / ([ab] +) c1/ to remember old states. Such patterns are disqualified as being regular expressions in the term’s classic sense.

    11. Question 11. What Happens If A Reference Is Returned To Private Variable?

      Answer :

      Your variables are kept on track by the Perl, whether dynamic or else, and does not free things before you use them.

    12. Question 12. Define Scalar Data And Variables?

      Answer :

      The concept of data types is flexible, which is present in Perl. Scalar is a single thing such as a string or a number. The java concepts such as int, float, string, and double are similar to scalar concept of Perl. Strings and numbers are exchangeable. Scalar variable is nothing but a Perl variable which is used to store scalar data. A dollar sign $ is used by it which is followed by underscores or alphanumeric characters. It is a case sensitive.

    13. Question 13. Why -w Argument Is Used With Perl Programs?

      Answer :

      -w option of the interpreter is used by most of the Perl developers especially in the development stage of an application. It is warning option to turn on multiple warning messages that are useful in understanding and debugging the application.

    14. Question 14. Which Has Highest Precedence In Between List And Terms? Explain?

      Answer :

      In Perl, the highest precedence is for Perl. Quotes, variables, expressions in parenthesis are included in the Terms. The same level of precedence as Terms is for List operators. Especially, these operators have strong left word precedence.

    15. Question 15. Define A Short Circuit Operator?

      Answer :

      The C-style operator ll carries out logical operation which is used to tie logical clauses, overall value of true is returned if either clause is true. This operator is known as short-circuit operator because you need not check or evaluate right operand if the left operand is true.

    16. Question 16. In Perl, Name Different Forms Of Goto And Explain?

      Answer :

      In Perl, there are three different forms for goto, they are:
      • goto name
      • goto label
      • goto expr
      goto name is used along with subroutines, it is used only when it is required as it creates destruction in programs. It is the second form of label where Execution is transferred to a statement labeled LABEL using goto LABEL. The last label form is goto EXPR which expects EXPR to evaluate label.

    17. Question 17. Can You Add Two Arrays Together?

      Answer :

      Yes, it is possible to add two arrays together with a push function. A value or values to end of the array is added using push function. The values of list are pushed on to the end of an array using push function. Length of list is used to increase length of an array.

    18. Question 18. How Shift Command Is Used?

      Answer :

      The first value of an array shifted using shift array function and it is returned, which results in array shortening by one element and moves everything from a place to left. If an array is not specified to shift, shift uses @ ARGV, the command line arguments of an array is passed to script or to an array named @.

    19. Question 19. Explain Different Types Of Eval Statements?

      Answer :

      In general, there are two types of eval statements they are:
      • Eval BLOCK and
      • Eval EXPR
      An expression is executed by eval EXPR and BLOCK is executed by eval BLOCK. Entire block is executed by eval block, BLOCK. When you want your code passed in expression then first one is used and to parse code in the block, second one is used.

    20. Question 20. Describe Returning Values From Subroutines?

      Answer :

      The value of last expression which is evaluated is the return value of subroutine or explicitly, a returned statement can be used to exit subroutine which specifies return value. This return value is evaluated in perfect content based on content of subroutine call.

       

    21. Question 21. What Are The Two Different Types Of Data Perl Handles?

      Answer :

      Perl handles two types of data they are
      (i) Scalar Variables and
      (ii) Lists
      Scalar variables hold a single data item whereas lists hold multiple data items.

    22. Question 22. 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.

    23. Question 23. Explain About Lists?

      Answer :

      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.

    24. Question 24. Name All The Prefix Dereferencer In Perl?

      Answer :

      The symbol that starts all scalar variables is called a prefix dereferencer. The different types of dereferencer are.
      (i) $-Scalar variables
      (ii) %-Hash variables
      (iii) @-arrays
      (iv) &-subroutines
      (v) Type globs-*myvar stands for @myvar, %myvar.

    25. Question 25. Explain About An Ivalue?

      Answer :

      An ivalue is an item that can serve as the target of an assignment. The term I value originally meant a “left value”, which is to say a value that appears on the left. An ivalue usually represents a data space in memory and you can store data using the ivalues name. Any variable can serve as an ivalue.

    26. Question 26. How Does A "grep" Function Perform?

      Answer :

      Grep returns the number of lines the expression is true. Grep returns a sub list of a list for which a specific criterion is true. This function often involves pattern matching. It modifies the elements in the original list.

    27. Question 27. Explain About Typeglobs?

      Answer :

      Type globs are another integral type in perl. A typeglob`s prefix derefrencer is *, which is also the wild card character because you can use typeglobs to create an alias for all types associated with a particular name. All kinds of manipulations are possible with typeglobs.

    28. Question 28. Is There Any Way To Add Two Arrays Together?

      Answer :

      Of course you can add two arrays together by using push function. The push function adds a value or values to the end of an array. The push function pushes the values of list onto the end of the array. Length of an array can be increased by the length of list.

    29. Question 29. How To Use The Command Shift?

      Answer :

      Shift array function shifts off the first value of the array and returns it, thereby shortening the array by one element and moving everything from one place to the left. If you don’t specify an array to shift, shift uses @ ARGV, the array of command line arguments passed to the script or the array named @-.

    30. Question 30. What Exactly Is Grooving And Shortening Of The Array?

      Answer :

      You can change the number of elements in an array simply by changing the value of the last index of/in the array $#array. In fact, if you simply refer to a nonexistent element in an array perl extends the array as needed, creating new elements. It also includes new elements in its array.

    31. Question 31. What Are The Three Ways To Empty An Array?

      Answer :

      The three different ways to empty an array are as follows
      1) You can empty an array by setting its length to a negative number.
      2) Another way of empting an array is to assign the null list ().
      3) Try to clear an array by setting it to undef, but be aware when you set to undef.

    32. Question 32. How Do You Work With Array Slices?

      Answer :

      An array slice is a section of an array that acts like a list, and you indicate what elements to put into the slice by using multiple array indexes in square brackets. By specifying the range operator you can also specify a slice.

    33. Question 33. What Is Meant By Splicing Arrays Explain In Context Of List And Scalar.

      Answer :

      Splicing an array means adding elements from a list to that array, possibly replacing elements now in the array. In list context, the splice function returns the elements removed from the array. In scalar context, the splice function returns the last element removed.

    34. Question 34. 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

    35. Question 35. Which Has The Highest Precedence, List Or Terms? Explain?

      Answer :

      Terms have the highest precedence in perl. Terms include variables, quotes, expressions in parenthesis etc. List operators have the same level of precedence as terms. Specifically, these operators have very strong left word precedence.

    36. Question 36. What Is Perl Scripting?

      Answer :

      Perl Scripting is one of the robust scripting languages in the IT market which is being used in “n” of fields. Perl is rich in finding Regular expressions and stands unique in all fields of application.

      PERL is a scripting language. Since all scripting languages are interpreter based languages but not compiler based languages, we use for optimization of code in all application.

    37. Question 37. Why Do We Use Perl Scripting?

      Answer :

      We use PERL scripting because it is rich in all regular expressions and functional concepts, we can create our own rules to find out particular generalized pattern by using regular expression. PERL supports or compatible in almost 76+ Operating systems and supports more than 3000 modules, called as CPAN (Comprehensive Perl Archive Network) modules.

    38. Question 38. What Is A Subroutine?

      Answer :

      Subroutine is perl is a block of code specially combined/grouped to perform a particular task.Which can be called at any point of time in a perl program.
      Advantage using Subroutine
      a) helps in modular programming making it easier to understand and maintain.
      b)eliminates duplication by reusing the same code/calling the subroutine.

    39. Question 39. Name An Instance You Used In Cpan Module?

      Answer :

      CGI, DBI etc are very common packages used from CPAN. there are thousands of other useful modules.

    40. Question 40. I Have A Variable Named $objref Which Is Defined In Main Package. I Want To Make It As A Object Of Class Xyz. How Could I Do It?

      Answer :

      use XYZ;
      my $objref= XYZ->new();

    41. Question 41. What Is Meant 'die' In A Perl Program?

      Answer :

      If the condition defined before the DIE statement is NOT met, the script will stop execution at that point, printing out the default error, if a custom error message is not defined.

    42. Question 42. What Is Hash In Perl?

      Answer :

      Hash in basically used to comment the script line.
      A hash is and unordered set of key/value pairs that you access using strings (keys) as subscripts, to look up the scalar value corresponding to a given key.

    43. Question 43. What Does This Mean :
      '$_' ?

      Answer :

      Default variable in Perl.
      Its an Default variable in Perl, where the input from the user will be taken into this variable if the variable is not defined by the user.

    44. Question 44. What Is A Datahash(). What Does It Mean? And For What Purpose It Is Used??

      Answer :

      In Win32::ODBC, DataHash() function is used to get the data fetched through the sql statement in a hash format.

    45. Question 45. Explain About Returning Values From Subroutines (functions)?

      Answer :

      The return value of the subroutine is the value of the last expression evaluated or you can explicitly use a return statement to exit the subroutine specifying the return value. That return value is evaluated in the appropriate content depending on the content of the subroutine call.

    46. Question 46. What Is Meant By A 'pack' In Perl?

      Answer :

      • Pack Converts a list into a binary representation
      • Takes an array or list of values and packs it into a binary structure, returning the string containing the structure
      • Hope that kills the problem

    47. Question 47. How Do You Connect To Database In Perl

      Answer :

      There is DBI module. use DBI;my $dbh = DBI->connect('dbi:Oracle:orcl', 'username', 'password',)where username and password is yours. This is example for oracle database.

      For Sybase:
      use DBI;
      my $dbh = DBI->connect('dbi:Sybase:server=$SERVER', 'username', 'password')

    48. Question 48. 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.

    49. Question 49. How To Connect With Sqlserver From Perl And How To Display Database Table Info?

      Answer :

      There is a module in perl named DBI - Database independent interface which will be used to connect to any database by using same code. Along with DBI we should use database specific module here it is SQL server. for MSaccess it is DBD::ODBC, for MySQL it is DBD::mysql driver, for integrating oracle with perl use DBD::oracle driver is used. IIy for SQL server there are available many custom defined ppm( perl package manager) like Win32::ODBC, mssql::oleDB etc.so, together with DBI, mssql::oleDB we can access SQL server database from perl. The commands to access database is same for any database.

    50. Question 50. 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.

    51. Question 51. How To Turn On Perl Warnings? Why Is That Important?

      Answer :

      Perl is very forgiving of strange and sometimes wrong code, which can mean hours spent searching for bugs and weird results. Turning on warnings helps uncover common mistakes and strange places and save a lot of debugging time in the long run. There are various ways of turning on Perlwarnings:

      * For Perl one-liner, use -w option on the command line.
      * On Unix or Windows, use the -w option in the shebang line (The first # line in the script). Note: Windows Perl interpreter may not require it.
      * For other systems, choose compiler warnings, or check compiler documentation.

    52. Question 52. Write A Script To Reverse A String Without Using Perl's Built In Functions?

      Answer :

      my $txt = 'Hello World';
      my $len= length($txt);
      my $rev;
      while($len > 0){
      $len--;
      $rev .= substr($txt,$len,1);
      }
      print $txt, ' - Reversed = ' , $rev;

    53. Question 53. What Is Perl One-liner?

      Answer :

      There are two ways a Perl script can be run:
      --from a command line, called one-liner, that means you type and execute immediately on the command line. You'll need the -e option to start like "C: %gt perl -e "print "Hello";". One-liner doesn't mean one Perl statement. One-liner may contain many statements in one line.
      --from a script file, called Perl program.

    54. Question 54. 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.

    55. Question 55. What Is Your Experience Of Interfacing Perl To Database?

      Answer :

      The correct answer is DBI

    56. Question 56. What Is Cpan ? What Are The Modules Coming Under This?

      Answer :

      CPAN is Comprehensive Perl Archive Network. It’s a repository contains thousands of Perl modules, source and documentation, and all under GNU/GPL or similar license. Some Linux distributions provide a tool named "cpan" with which you can install packages directly from CPAN

    57. Question 57. Given A File, Count The Word Occurrence (case Insensitive)?

      Answer :

      open(FILE,"filename");
      @array=; $wor="word to be found";
      $count=0; foreach $line (@array) { @arr=split (/s+/,$line);
      foreach $word (@arr) { if ($word =~ /s*$wors*/i) $count=$count+1; } }

      print "The word occurs $count times";

    58. Question 58. 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';

    59. Question 59. Why We Use Perl?

      Answer :

      1.Perl is a powerful free interpreter.
      2.Perl is portable, flexible and easy to learn.

      -For shell scripting
      -For CGI
      -Tons of scripts are available.
      -Easy development
      -Enormous big support script archive like CPAN
      -No one starts to write a Perl scripts from scratch, you choose one from an archive and modify that.
      -It is a "mature" scripting language.
      -You may find Perl interpreter on every mission critical environment
      -Easy to learn

    60. Question 60. Why Does Perl Not Have Overloaded Functions?

      Answer :

      Because you can inspect the argument count, return context, and object types all by yourself.
      In Perl, the number of arguments is trivially available to a function via the scalar sense of @_, the return context via want array(), and the types of the arguments via ref() if they're references and simple pattern matching like /^d+$/ otherwise. In languages like C++ where you can't do this, you simply must resort to overloading of functions.

    61. Question 61. Which Of These Is A Difference Between C++ And Perl?

      Answer :

      Perl can have objects whose data cannot be accessed outside its class, but C++ cannot.
      Perl can use closures with unreachable private data as objects, and C++ doesn't support closures. Furthermore, C++ does support pointer arithmetic via `int *ip = (int*)&object', allowing you do look all over the object. Perl doesn't have pointer arithmetic. It also doesn't allow `#define private public' to change access rights to foreign objects. On the other hand, once you start poking around in /dev/mem, no one is safe.

    62. Question 62. How To Concatenate Strings With Perl?

      Answer :

      Method #1 - using Perl's dot operator:
      $name = 'checkbook';
      $filename = "/tmp/" . $name . ".tmp";

      Method #2 - using Perl's join function
      $name = "checkbook";
      $filename = join "", "/tmp/", $name, ".tmp";

      Method #3 - usual way of concatenating strings
      $filename = "/tmp/${name}.tmp";

    63. Question 63. What Is The Difference Between Chop & Chomp Functions In Perl?

      Answer :

      chop is used to remove last character,chomp function removes only line endings.

    64. Question 64. What Is Hash?

      Answer :

      Hash is an associative array where data is stored in
      "key"->"value" pairs.
      Eg : fruits is a hash having their names and price
      %fruits = ("Apple", "60", "Banana", "20", "Peers", "40");

    65. Question 65. How Would You Replace A Char In String And How Do You Store The Number Of Replacements?

      Answer :

      $str='Hello';
      $cnt= ($str=~s/l/i/g);
      print $cnt;

    66. Question 66. How Do You Open A File For Writing?

      Answer :

      open FILEHANDLE, ">$FILENAME"

    67. Question 67. What's Your Favorite Module And Why?

      Answer :

      My Favourite module is CGI.pm Bcoz it can handle almost all the tasks like
      1. parsing the form input
      2. printiing the headers
      3. can handle cookies and sessions and much more

    68. Question 68. How To Implement Stack In Perl?

      Answer :

      Stack is LIFO (Last in First out), In perl that could be inplemented using the push() and shift() functions. push() adds the element at the last of array and shift() removes from the beginning of an array.

    69. Question 69. Why Do You Program In Perl?

      Answer :

      Perl is easy, fast and its fun to code in perl.
      Perl is rich with various packages, N/w programming is very easy and there are lot more advantages to say.

    70. Question 70. How We Can Navigate The Xml Documents?

      Answer :

      You can use SAX if what you require is simple accesing of the xml structure. You can go for DOM if you need node handling capabilities like inserting a node, modifying a node, deleteing node and stuff like that.

    71. Question 71. Help In Perl?

      Answer :

      perldoc -f print

    72. Question 72. What Is The Use Of "stderr()"?

      Answer :

      STDERR:
      The special filehandle for standard error in any package.

    73. Question 73. Advantages Of C Over Perl?

      Answer :

      In reality PERL interpreter is written in C. So what all advantages C have are also possesed by PERL. Otherwise C is faster than PERL, because PERL is an interpreted language.

    74. Question 74. 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"

    75. Question 75. What Does The Word '&myvariable' Mean?
      What Does The Symbol '&' Means? What's Purpose Of It?

      Answer :

      &myvariable is calling a sub-routine.

      & is used to identify a sub-routine.

    76. Question 76. What Is Super?

      Answer :

      Super refers to current package ancestor.

    77. Question 77. What Is Rpc? Why Do I Need It?

      Answer :

      RPC:A call to a procedure in a different address space. In a traditional procedure call, the calling procedure and the called procedure are in the same address space on one machine. In a remote procedure call, the calling procedure invokes a procedure in a different address space and usually on a different machine.

    78. Question 78. What Does Init 5 And Init 0 Do?

      Answer :

      init 5 will shutdown and Power-off the server.

      init 0 will bring the server to the ok> prompt (Fourth monitor)

    79. Question 79. What Does Ndd Do?

      Answer :

      ndd command will hardcore the speed of the network interface card.

    80. Question 80. What Is Obp And How Do You Access It?

      Answer :

      OBP is called as Open Boot PROM. This OBP can be accessiable thru ok> prompt

    81. Question 81. How Do You Boot From Cd-rom?

      Answer :

      Booting form CD-ROM can be done by the command
      ok >boot cdrom

    82. Question 82. What Is /etc/system For?

      Answer :

      /etc/system is a kernal file of Solaris OS.

    83. Question 83. How Do You Boot From A Network With Jumpstart?

      Answer :

      boot net - install

    84. Question 84. What Is Jumpstart?

      Answer :

      The Jumpstart feature is an automatic installation process available in the Solaris operating environment. It allows system administrators to categorize machines on their network and automatically install systems based on the category to which a system belongs.

    85. Question 85. What Is Lom

      Answer :

      Short for LAN on motherboard. The term refers to a chip or chipset capable of network connections that has been embedded directly on the motherboard of a desktop, workstation or server. Instead of requiring a separate network interface card to access a local-area network, such as Ethernet, the circuits are attached to the motherboard. An advantage of a LOM system is an extra available PCI slot that is not being used by the network adapter.

    86. Question 86. How To Create A Package?

      Answer :

      pkgmk -o -r / -d /tmp -f Prototype

    87. Question 87. How Do You View Shared Memory Statistics?

      Answer :

      swap -l -> displays swap usage
      prstat -> examines all active processes on the system and reports statistics based
      on the selected output mode and sort order
      vmstat -> reports information about processes, memory, paging, block IO, traps,
      and cpu activity
      pmap -> lists the virtual memory mappings underlying the given process

    88. Question 88. What Is Vts?

      Answer :

      Sun Validation Test Suite -> tests and validates Sun hardware by verifying the configuration and functionality of hardware controllers, devices

    89. Question 89. What Is Grep Used For In Perl?

      Answer :

      Grep is used with regular expression to check if a parituclar value exist in an array. it returns 0 if the value does not exists, 1 otherwise.

    90. Question 90. How To Code In Perl To Implement The Tail Function In Unix?

      Answer :

      You have to maintain a structure to store the line number and the size of the file at that time eg. 1-10bytes, 2-18bytes.. you have a counter to increase the number of lines to find out the number of lines in the file. once you are through the file, you will know the size of the file at any nth line, use 'sysseek' to move the file pointer back to that position (last 10) and then start reading till the end.

    91. Question 91. What Are The Arguements We Normally Use For Perl Interpreter

      Answer :

      -e for Execute, -c to compile, -d to call the debugger on the file specified, -T for traint mode for security/input checking -W for show all warning mode (or -w to show less warning)

    92. Question 92. What Is It Meants By '$_'?

      Answer :

      it is a default variable which holds automatically, a list of arguements passed to the subroutine within parenthesis.

    93. Question 93. What Is The Tk Module?

      Answer :

      it provides a GUI interface.

    94. Question 94. How To Concatinate Strings In Perl?

      Answer :

      through . operator

    95. Question 95. 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.

    96. Question 96. How Do Find The Length Of An Array?

      Answer :

      $@array

    97. Question 97. What Does Read() Return At End Of File?

      Answer :

      A defined (but false) 0 value is the proper indication of the end of file for read() and sysread().

    98. Question 98. How Do You Print Out The Next Line From A Filehandle With All Its Bytes Reversed?

      Answer :

      print scalar reverse scalar Surprisingly enough, you have to put both the reverse and the into scalar context separately for this to work.

    99. Question 99. What Does Perl Do If You Try To Exploit The Execve(2) Race Involving Setuid Scripts?

      Answer :

      Sends mail to root and exits. It has been said that all programs advance to the point of being able to automatically read mail. While not quite at that point (well, without having a module loaded), Perl does at least automatically send it.

    100. Question 100. What Are Scalar Data And Scalar Variables?

      Answer :

      Perl has a flexible concept of data types. Scalar means a single thing, like a number or string. So the Java concept of int, float, double and string equals to Perl's scalar in concept and the numbers and strings are exchangeable. Scalar variable is a Perl variable that is used to store scalar data. It uses a dollar sign $ and followed by one or more aphanumeric characters or underscores. It is case sensitive.

    101. Question 101. How To Start Perl In Interactive Mode?

      Answer :

      perl -e -d 1 PerlConsole.

    102. Question 102. What Package You Use To Create A Windows Services?

      Answer :

      use Win32::OLE.

    103. Question 103. What Is A Datahash()

      Answer :

      in Win32::ODBC, DataHash() function is used to get the data fetched through the sql statement in a hash format.

    104. Question 104. What Does This Symbol Mean '->'?

      Answer :

      In Perl it is an infix dereference operator. for array subscript, or a hash key, or a subroutine, then this must be a reference. can also be used as method invocation.

    105. Question 105. What Is Cpan?

      Answer :

      CPAN is comprehensive Perl Archive Network. its a repository contains thousands of Perl Modules, source and documentation, and all under GNU/GPL or smilar licence. Some linux distribution provide a till names 'cpan'; which you can install packages directly from cpan.

    106. Question 106. What Is The Difference Between Exec And System?

      Answer :

      exec runs the given process, switches to its name and never returns while system forks off the given process, waits for its to complete and then return.

    107. Question 107. What Is The Difference Between For And Foreach?

      Answer :

      functionally, there is no difference between them.

    108. Question 108. What Is A Regular Expression?

      Answer :

      it defines a pattern for a search to match.

    109. Question 109. What Is Stderr() In Perl?

      Answer :

      special file handler to standard error in any package.

    110. Question 110. List The Files In Current Directory Sorted By Size ?

      Answer :

      - ls -l | grep ^- | sort -nr

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Perl Scripting Tutorial