Yahoo Interview Question for Production Engineers

Comment hidden because of low score. Click to expand.
of 1 vote

scalar variable $variableName
array variable @variableName
hash variable %variable_name

using -e option to see if a file exists
if( -e $fileName)

- durgesh October 07, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
of 0 vote

An example of three kinds of variables

/home/gkhurana> perl
print "\nPrinting scalar\n";

$a = "10";
$b = "HI how are you ";
print $a;
print "\n";
print $b;
print "\n";

print "\nPrinting array values";
print "$_\n";

%a = ( 1 =>'one' , 2=>"two");

print "\nPrinting Hash\n";
while (($key, $value)=each %a)
print "keys = $key value = $value \n";


#Output below
Printing scalar
HI how are you

Printing array values1

Printing Hash
keys = 1 value = one
keys = 2 value = two

- Gaurav Khurana March 04, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
of 2 vote

Basic Variables in Perl:
1.Scalar Variables -->Scalar variables are simple variables containing only one element--a string, a number, or a reference.
2.Array Variables--> Arrays contain a list of scalar data (single elements).Denoted by @
3.Hashes -->are complex lists with both a key and a value part for each element of the list.

To see if a file exists: First open a file ..if it doesnt open display error

open MYFILE , "filename" || "die $!";

- Anonymous August 26, 2011 | Flag Reply

Add a Comment

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.


is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More


CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More