CGI Perl Interview Questions and Answers

CGI Perl Questions and Answers:

1 :: Write a script to display mirror image of a entered value and also check whether Palindrome?

print("Enter the no. to check for Palindrome : ");
$no = <STDIN>;
chop($no);

$i = 0;

# Store into a array
while($no != 0)
{
@array[$i] = $no % 10;
$no = int($no / 10);
$i++;
}

$i--;
$j=0;
$flag = "true";

# Check for Palindrome
while( ($flag eq "true" )&& ( $j < @array/2) ){
if (@array[$j] != @array[$i])
{
$flag = "false"
}
$i--;
$j++;
}

# Print the result
if( $flag eq "true")
{
print("It is a Palindrome\n");
}
else
{
print("It is NOT a Palindrome\n");
}
0/5 Rating (0 vote)
Is This Answer Correct?    0 Yes 0 No
Place Your Answer

2 :: Write a script to generate n prime no.s?

#!c:\perl\bin\perl

$Count = 0;
$pt = 2;
while ( $Count < @ARGV[0] )
{
if (isPrimary($pt))
{
print "$pt\n";
$Count++;
}
$pt++;
}

sub isPrimary
{
$flag = 1;
for ($i=2; $i<=$_[0]/2; $i++)
{
if ($_[0] % $i == 0)
{
$flag = 0;
}
}
return $flag;
}
0/5 Rating (0 vote)
Is This Answer Correct?    0 Yes 0 No
Place Your Answer

3 :: Why we use "use lib $path"?

If we are trying to add a module or library files in our
program using require or use statement then it will search
that module or library files in the Perl's default search path.

The statement use lib is used to add the directories to
default search path.

So if the module or library file is not located in the
Perl's default search path then it will find the library
files in the path we have given with the use lib $path.
0/5 Rating (0 vote)
Is This Answer Correct?    0 Yes 0 No
Place Your Answer

4 :: Difference between Perl and Mod_perl?

Perl is a language and MOD_PERL is a module of Apache used
to enhance the performance of the application.
5/5 Rating (1 vote)
Is This Answer Correct?    1 Yes 1 No
Place Your Answer

5 :: How to make the following assignment, as arrayreference assignment?

my $arr_ref=[1,2,3,4,4,elem];

my $ref=[1,2,3,4];
print ref $ref;

ref will return the type of reference.
In this case ref will return as 'ARRAY'.
0/5 Rating (0 vote)
Is This Answer Correct?    0 Yes 0 No
Place Your Answer

Rate This Category:
0/5 Rating (0 vote)
Place Your Question



Top: CGI Perl Interview Questions and Answers
CGI Perl Interview Questions and Answers

Top Frequently Asked CGI Perl Question
Frequently Asked CGI Perl Job Interview Question


Top Frequently opened Computer Programming Job Interview categories
Most popular Computer Programming Job Interview categories

Comments About CGI Perl Interview Questions and Answers

Share your valuable opinions, ideas and suggestions about CGI Perl Interview Questions and Answers
While placing your comment your email address is required but won't be published any where else; Personal information will be kept confidential; we do not sell or release our respective visitors private information.
  1. Webmaster 20th of May 2012

    Webmaster Said

    Tell us what you feel about CGI Perl Interview Questions and Answers
    All comments will be published after review. No login or registration is required to post a comment on CGI Perl Interview Questions and Answers We offer and invite you to submit your valuable comment now; Please be respectful of others when commenting. Insulting others, self-promotional comments, website promotional comments, marketing stuff, SEO Techniques, SMS-style content and off-topic comments will not be approved at this information portal.
    So start sharing your thoughts regarding CGI Perl Interview Questions and Answers
    Thank you.

Leave a Comment

Leave a Comment
  1.  Enter This Verification Code  Regenerate Verification Code  



Your reply will be added to the comment above (Below any other replies to this comment) -

Top Comments About: CGI Perl Interview Questions and Answers
Comments on CGI Perl Interview Questions and Answers

 
Top of Link batk to CGI Perl Interview Questions and Answers
Link batk to CGI Perl Interview Questions and Answers