Find Interview Questions for Top Companies
Ques:- Why is it hard to call this function: sub y { “because” } ?
Asked In :-
Ques:- What happens to objects lost in “unreachable” memory, such as the object returned by Ob->new() in `{ my $ap; $ap = [ Ob->new(), $ap ]; }’ ?
Asked In :-
Ques:- What’s the difference between /^Foo/s and /^Foo/?
Asked In :-
Ques:- What does `$result = f() .. g()’ really return?
Asked In :-
Ques:- What does `new $cur->{LINK}’ do? (Assume the current package has no new() function of its own.)
Asked In :-
Ques:- Assuming both a local($var) and a my($var) exist, what’s the difference between ${var} and ${“var”}?
Asked In :-
Ques:- If EXPR is an arbitrary expression, what is the difference between $Foo::{EXPR} and *{“Foo::”.EXPR}?
Asked In :-
Ques:- Perl uses single or double quotes to surround a zero or more characters. Are the single(‘ ‘) or double quotes (” “) identical?
Asked In :-
Ques:- How to check the status of airplane mode (enable/disable) in perl for Android mobile?
Asked In :-
Ques:- how to connect cisco switch uisng perl script
Asked In :-
Ques:- how to get back up from private character editor which is saved in the format of .udf
Asked In :-
Ques:- There is no strict data types in perl unlike in other high level languages like Java so wouldn’t that be a problem if a code in perl is to be a written by a big team of 20+ members ?”
Asked In :-
Ques:- We all know private variables exist in perl. But do private METHODS exist in perl ? Eg ?
Asked In :-
Ques:- Write an expression or perl script to identify the entered ip address is valid or not?
Asked In :-
Comments
Admin May 17, 2020

print "Enter an ip address: ";
$ans=<stdin>;
chomp($ans);
if ($ans =~ m/^(d{1,3}).(d{1,3}).(d{1,3}).(d{1,3})$/)
{
if (($1<=255) && ($2<=255) && ($3<=255) &&
($4<=255))
{
print "An IP Address";
}
else
{
print "Not an IP Address";
}
}
else
{
print "Not an IP Address";
}

Admin May 17, 2020

The first reply won't match 192.168.99.99. [0-5] matches
only 0,1,2,3,4,5. How about the other numbers?
Second one is almost correct, but the first octet can't be
'0'. I mean, 0.1.2.3 is not a valid address.
print "Enter an ip address: ";
$ans=<stdin>;
chomp($ans);
if ($ans =~ m/^(d{1,3}).(d{1,3}).(d{1,3}).(d{1,3})$/)
{
if ( ($1>0) && ($1<=255) && ($2<=255) && ($3<=255) &&
($4<=255))
{
print "An IP Address";
}
else
{
print "Not an IP Address";
}
}
else
{
print "Not an IP Address";
}

Ques:- Hi, I am an accountant. I am preparing a balance sheet, but because of staff shortage and time pressures, I can’t complete it on time. There is a lot of common data from last year which I don’t need to retype, and I can manage by editing last year’s balance sheet. Is there any software available online where I can do this easily?
Asked In :-
Ques:- Why we use CGI?
Asked In :-
Ques:- Packing and Unpacking. Hi, I want to get output as 0x23400000345…. in the below example How to get? i tried out, but unable to get the answer $r=0x234; $t=0x345; $y=pack(‘L L’,$t,$r); $x1=unpack(‘L!’,pack(‘P’,$y)); printf(“nThe value is $x1”); I didn’t get constant output
Asked In :-
Comments
Admin May 17, 2020

use the following code.
<code>
use bigint;
my $r = 0x234;
my $t = 0x345;
my $x1 = $r << 32 | $t;
print $x1->as_hex;
</code>

Ques:- sort a word “system” in perl/shell without using built in functions output should be emssty
Asked In :-
Comments
Admin May 17, 2020

$value = "system";
@SortedArray = split('',$value);
$strlength = @SortedArray;
print "Current sort @SortedArray
";
$swapped = 0;
for($i=0; $i < $strlength; $i++){
for (my $j = 0; $j < $strlength-1-$i; $j++) {
if($SortedArray[$j] gt $SortedArray[$j+1]){
$tmp = $SortedArray[$j];
$SortedArray[$j] = $SortedArray[$j+1];
$SortedArray[$j+1] = $tmp;
$swapped =1;
}
}
if ($swapped) {
next;
}
}
print join('', split(' ', "@SortedArray")), "
";

Admin May 17, 2020

======= PERL SCRIPT (sortword.pl) =========
#!/usr/bin/perl
my $word = $ARGV[0];
$sortword = "";
$lastchar = "";
while($word =~ /(.)/g)
{
$lastchar = $1;
if( $sortword ) {
$flag = "";
$newsortword = "";
while($sortword =~ /(.)/g) {
if( $lastchar gt $1 || $flag
eq "charcovered") {
$newsortword =
$newsortword.$1;
$flag = "greater" if($flag
ne "charcovered")
}
else {
$newsortword =
$newsortword.$lastchar.$1;
$flag = "charcovered";
}
}
if( $flag ne "charcovered" ) {
$newsortword =
$newsortword.$lastchar;
}
$sortword = $newsortword;
}
else {
$sortword = $lastchar;
}
}
print $sortword."n";
======= PERL SCRIPT =========
Run the script as:
sortword.pl "system"

Ques:- How to sort dates in Perl ?
Asked In :-
Comments
Admin May 17, 2020

Try the following way.
Example
-------
use Data::Dumper;
my @dates = ( "02/11/2009" , "20/12/2001" , "21/11/2010" ) ;
@dates = sort { join( '', (split '/', $a)[2,1,0] ) cmp
join( '', (split '/', $b)[2,1,0]) } @dates;
print Dumper @dates;

Ques:- Write a script to reverse a string without using Perl’s built in function
Asked In :-
Comments
Admin May 17, 2020

my $i;
my $str="hello";
my @str=split('',$str);
for($i=$#str;$i>=0;$i--)
{
print $str[$i];
}

Admin May 17, 2020

#!/usr/bin/perl
my $str = "hello";
$revstr = "";
while($str =~ /(.)/g)
{
$revstr = $1.$revstr;
}
print $revstr."n";



The CGI Perl category on takluu.com is tailored for those who want to master web scripting and server-side programming using Perl in the context of CGI (Common Gateway Interface). Whether you’re applying for roles in legacy systems, automation testing, or back-end services, this section provides deep insights into Perl’s role in building dynamic web content.

Here, you’ll find the most commonly asked interview questions that test your understanding of CGI architecture, Perl syntax, form handling, server environment variables, file operations, and security practices in web applications.

Frequently covered questions include:

  • “What is CGI and how does it work with Perl?”

  • “How do you read form input using CGI Perl?”

  • “What are the advantages of using CGI with Perl?”

  • “How can you handle file uploads securely in CGI scripts?”

  • “Explain the difference between GET and POST methods in CGI.”

We break down complex scripting techniques into simple explanations and provide sample code snippets that mirror real-world scenarios. Whether you’re a beginner trying to understand the fundamentals or an experienced developer brushing up for an interview, this category offers immense value.

Our content is updated regularly based on recent interview patterns from tech companies that still rely on CGI-based systems or maintain older infrastructures.

Let Takluu be your preparation partner for CGI Perl roles and give you the confidence to crack even the toughest questions.

AmbitionBox Logo

What makes Takluu valuable for interview preparation?

1 Lakh+
Companies
6 Lakh+
Interview Questions
50K+
Job Profiles
20K+
Users