Sei sulla pagina 1di 2

Perl Basics What is CPAN? Its uses? What does use strict , use vars , no vars mean?

Difference b/w use and require? What do the symbols $ @ and % mean when prefixing a variable? What purpose does each of the following serve: -w, strict, -T ? Explain the use of do, require, use, import Use of our, my and local? Use of ref function What are STDIN,STDOUT and STDERR?. @INC and %INC How you can invoke shell command? Hint: system(), backtick, exec() in details What is the exact difference between system() and exec() (similar to question no 11) Error handling using eval Print the array @arr in reversed case-insensitive order . There are two types of eval statements i.e. eval EXPR and eval BLOCK. Explain th em. Autovivification (very rarely) Questions on hash and hash reference Sort a hash by values Length of a hash How to refer a hash and how to dereference it Nesting of hash Chomp and chop Explain qw,qq,qx (what s its use, when to use) What are the different ways to concatenate strings in Perl Functions on array: Push, pop, shift, unshift, join, split, splice Different hash functions like each, keys, values, exists, delete Numeric and string sorting of hash and array elements in Perl How to set Environment variables in Perl (Hint: %ENV) Use of map and grep functions in Perl What is the difference between die and exit in perl Array with repeating digits. Sort and print digits with no of counts. Ex: @arr = (1,2,4,6,3,1,2,6,8,3,4,9,1,2,4). Output should be @arr = (1,1,1,2,2,2,3,3,4,4,4 ,6,6,8,9) ). You can t use hash feature. Think about optimization too. Write a Perl script for decimal to binary, decimal to octal, decimal to hex, hex to decimal,hex to octal, hex to binary and any such possible data conversion How to find which method is being invoked or being called in Perl and in which m ethod you are currently? Hint: caller() Explain the use of caller and wantarray function? How will you find line number, package and a file name in Perl? (Hint: __FILE__, __LINE__, __PACKAGE__) How to install a Perl Module from CPAN Pass an array to subroutine and get t as array ref in sub. Hint: subroutine prot otype. Ex: sub subname(\@) You have two arrays. Say @arr1 = (1,2,5,6) and @arr2 = (3,4) We need to put the element of @arr2 at @arr1 in such a way that @arr1 would become @arr1= (1,2,3,4, 5,6) without using third array. Hint: use splice function Inbuilt special variable like $!, $? Etc Piping in and piping out in Perl How to implement stack and queue in Perl? How to find the list of installed modules in Perl? Use of BEGIN and END block. Simulate the behaviour of use lib pragma using BEGIN block. File Handling in Perl File Testing. Binary or text, size, accessed like e, -f, -a, -c m etc Use of the special file handle _. (Note : its just _ not $_). Using this can sig nificantly improve performance in many cases.

Syntax for opening, appending, reading, writing files How to assign File handle into an array instead of using while loop? How to delete a file? How to copy or move a file? What the various file permissions (flags) in Perl? Given a file, count the word occurrence (case insensitive) Displaying file contents using hash in Perl Web based & Perl CGI What do you know about CGI.pm? How to set sessions and cookies and how to implement in Perl? How to display JSON based output Why two \n in print Content-type: text/html \n\n ; Database oriented How to connect database using DBI? What are the ways you know to get records from the table (fetchrow_hashref/array ref) Object Oriented Perl Diff b/w module and package Diff b/w class and package (rarely asked though ) How do you call any subroutine in object oriented fashion? Hint: bless operator Use base, EXPORT, EXPORT_OK Difference between ISA and EXPORT Use Base related questions Use of AUTOLOAD function. Regular Expression in Perl IP Address validation Email id Validation More than one @ is there. Give regex to store username and domain name after enc ountering last @ (Last @ will be the splitting point and more than one special c haracters can be there ) What are the uses of different modifiers Group, range, meta-character etc m, s, tr Replace the last x in a string with ax in one regex. Example : abcxdefgxgaxa should become abcxdefgxgaaxa Perl regular expression is greedy. Can you explain it with one example? Can you check palindrome condition using regular expression in perl? (Hint: rege x doesn t support recursion or counting facility ) Perl One Liner What is Perl one liner and where you will use it? What are the different options in Perl one Liner. Explain in details Add a blank line before every line. Remove blank lines form a file. Print the total number of lines in a file (emulate wc -l). Print the number of non-empty lines in a file. What option you will use to check syntax only without executing it? Which option is meant to enable all warnings or disable all warning inpite of us ing use warning or no warnings respectively?

Potrebbero piacerti anche