Perl Interview Preparation Questions

on 1:33 AM

Are you a developer? Need to update your software development knowledge or need to prepare for a job interview? Check out this collection of Perl Questions
  • Why do you use Perl?
  • How do I set environment variables in Perl programs?
  • Which of these is a difference between C++ and Perl?
  • How to open and read data files with Perl
  • How do I do fill_in_the_blank for each file in a directory?
  • How do I generate a list of all .html files in a directory?
  • What is Perl one-liner?
  • Assuming both a local($var) and a my($var) exist, what's the difference between ${var} and ${"var"}?
  • What happens when you return a reference to a private variable?
  • How to turn on Perl warnings? Why is that important?
  • What are scalar data and scalar variables?
  • Why should I use the -w argument with my Perl programs?
  • Assuming $_ contains HTML, which of the following substitutions will remove all tags in it? 1.s/<.*>//g; 2.s/<.*?>//gs; 3.s/<\/?[A-Z]\w*(?:\s+[A-Z]\w*(?:\s*=\s*(?:(["']).*?\1|[\w-.]+))?)*\s*>//gsix;
  • I want users send data by formmail but when they send nothing or call it from web site they will see error. codes in PHP like this: if (isset($HTTP_POST_VARS)){ .......... } else{ echo ("error lalalalal") } How it will look in perl?
  • What is the output of the following Perl program? 1 $p1 = "prog1.java"; 2 $p1 =~ s/(.*)\.java/$1.cpp/; 3 print "$p1\n";
  • Why aren't Perl's patterns regular expressions?
  • What does Perl do if you try to exploit the execve(2) race involving setuid scripts?
  • How do I do < fill-in-the-blank > for each element in a hash?
  • How do I sort a hash by the hash key?
  • How do you print out the next line from a filehandle with all its bytes reversed?
  • How do I send e-mail from a Perl/CGI program on a Unix system?
  • How to read from a pipeline with Perl
  • Why is it hard to call this function: sub y { "because" }
  • What does `$result = f() .. g()' really return?
  • Why does Perl not have overloaded functions?
  • What does read() return at end of file?
  • What does `new $cur->{LINK}' do? (Assume the current package has no new() function of its own.)
  • How do I sort a hash by the hash value?
  • How to read file into hash array ?
  • How do you find the length of an array?
  • What value is returned by a lone `return;' statement?
  • What's the difference between /^Foo/s and /^Foo/?
  • Does Perl have reference type?
  • How to dereference a reference?
  • What does length(%HASH) produce if you have thirty-seven random keys in a newly created hash?
  • If EXPR is an arbitrary expression, what is the difference between $Foo::{EXPR} and *{"Foo::".EXPR}?
  • How do I do < fill-in-the-blank > for each element in an array?
  • How do I replace every character in a file with a comma?
  • What is the easiest way to download the contents of a URL with Perl?
  • How to concatenate strings with Perl?
  • How do I read command-line arguments with Perl?
  • When would `local $_' in a function ruin your day?
  • What happens to objects lost in "unreachable" memory..... ?
  • Assume that $ref refers to a scalar, an array, a hash or to some nested data structure. Explain the following statements:
  • How do you match one letter in the current locale?
  • How do I print the entire contents of an array with Perl?
  • Perl uses single or double quotes to surround a zero or more characters. Are the single(' ') or double quotes (" ") identical?
  • How many ways can we express string in Perl?
  • How do you give functions private variables that retain their values between calls?

0 comments:

Post a Comment