Top CGI Perl Interview Questions :: ALLInterview.com http://www.allinterview.com Top CGI Perl Interview Questions en-us What is the difference between chop &amp; chomp functions in perl? http://www.allinterview.com/showanswers/36991.html chop is used remove last character,chomp function removes only line endings. Write a simple regular expression to match an IP address, e-mail ad http://www.allinterview.com/showanswers/16881.html For IP Address /([0-255])(\.)$1\1$1\1$1/; For other question answer may vary depending on the requirement. What is the difference between for &amp; foreach, exec &amp; system? http://www.allinterview.com/showanswers/16883.html Technically, there's no difference between for and foreach other than some style issues. One is an alias of another. You can do things like this foreach (my $i = 0; $i < 3; ++$i) { # normally this is foreach print $i, "n&quo What is a hash? http://www.allinterview.com/showanswers/16888.html 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&q Explain the difference between use and require? http://www.allinterview.com/showanswers/16879.html Use : 1. The method is used only for the modules(only to include .pm type file) 2. The included objects are varified at the time of compilation. 3. No Need to give file extension. Require: 1. The method is used for both libraries and Write a script for &#039;count the no.of digits using regular express http://www.allinterview.com/showanswers/37201.html Simple guys here we go :-)......... #!/usr/bin/perl -w use strict; my($test,$number) = ("",""); $test = "12344tyyyyy456"; $number = ($test =~ tr/[0-9]/[0-9]/); print "Number of digits in variable is :- How do you open a file for writing? http://www.allinterview.com/showanswers/16885.html open FILEHANDLE, ">$FILENAME" When would you not use Perl for a project? http://www.allinterview.com/showanswers/16887.html 1. When you are developing an application for a real time system in which processing speed is of utmost importnace When to use Perl 1. For large text processing 2. When application does lot of data manipulation 3. When you need fast developme How would you replace a char in string and how do you store the numb http://www.allinterview.com/showanswers/16886.html $str='Hello'; $cnt= ($str=~s/l/i/g); print $cnt; $cnt stores the number of replacements. What does the command &quot;use strict&quot; do and why should you u http://www.allinterview.com/showanswers/16873.html "Use strict" is one of the pragma used for checking the variable scope and syntax. If you use this pragma means, you need to specify the scope (my, local, our) for the variable and use the exact usage of operators. For eg. Checking Explain the difference between my and local? http://www.allinterview.com/showanswers/16878.html The variables declared with "my" can live only within the block it was defined and cannot get its visibility inherited functions called within that block, but one defined with "local" can live within the block and have its How would you trap error occurred in the perl program/file? http://www.allinterview.com/showanswers/61507.html Put your code inside of an eval. If an error occurs, the $@ variable will contain the error. You can also raise an error by using die inside of an eval. What is the difference between module and package? http://www.allinterview.com/showanswers/61504.html Modules and packages are usually used interchangeably. But there is a difference. a. Packages are perl files with .pm extn and is considered a separate namespace. So a package is nothing but group of related scalars,arrays,hashes and subrout Name an instance where you used a CPAN module? http://www.allinterview.com/showanswers/16884.html we will get a no.of modules from CPAN , there so many module for database interface, database drivers. to do the mathematical operations ,text processing . each module is to handle a small tasks . How to find out the version of PERL being installed on your LINUX mac http://www.allinterview.com/showanswers/10812.html Just write perl -v it will display the version: This is perl, v5.8.5 built.........