Interview Helper
Translate Page To German Tranlate Page To Spanish Translate Page To French Translate Page To Italian Translate Page To Japanese Translate Page To Korean Translate Page To Portuguese Translate Page To Chinese
  Number Times Read : 435      
  Go To Article# :  1 2 3 4  
Categories

Campus Interviews (99)
Career Helper (6)
Certification Dumps (9)
Code Samples (8)
Competitive Exams (49)
Interview Questions (349)
Walkin Interviews (20)
 
Stats
Total Articles: 566
Total Authors: 120
Total Downloads: 92940


Newest Member
Gagan Deep Sharma
 


   

Perl Interview Questions 3

By : Shaveta Aggarwal    99 or more times read
Submitted 2008-11-05 10:18:20 [Valid RSS feed]








Explain about lists?

A list is a construct that associates data elements together and you can specify a list by enclosing those elements in parenthesis and separating them with commas. They could themselves be arrays, hashes or even other lists. Lists do not have a specific list data type.

Does Perl have reference type?

Yes. Perl can make a scalar or hash type reference by using backslash operator.

For example

$str = "here we go"; # a scalar variable

$strref = $str; # a reference to a scalar

@array = (1..10); # an array

$arrayref = @array; # a reference to an array

Note that the reference itself is a scalar.

How to dereference a reference?

There are a number of ways to dereference a reference.

Using two dollar signs to dereference a scalar.

$original = $$strref;

Using @ sign to dereference an array.

@list = @$arrayref;

Similar for hashes.

What happens when you return a reference to a private variable?

Perl keeps track of your variables, whether dynamic or otherwise, and doesn't free things before you're done using them.

How to turn on Perl warnings? Why is that important?

Perl is very forgiving of strange and sometimes wrong code, which can mean hours spent searching for bugs and weird results. Turning on warnings helps uncover common mistakes and strange places and save a lot of debugging time in the long run. There are various ways of turning on Perl warnings:

For Perl one-liner, use -w option on the command line.

On Unix or Windows, use the -w option in the shebang line (The first # line in the script). Note: Windows Perl interpreter may not require it.

For other systems, choose compiler warnings, or check compiler documentation.

What are scalar data and scalar variables?

Perl has a flexible concept of data types. Scalar means a single thing, like a number or string. So the Java concept of int, float, double and string equals to Perl's scalar in concept and the numbers and strings are exchangeable. Scalar variable is a Perl variable that is used to store scalar data. It uses a dollar sign $ and followed by one or more alphanumeric characters or underscores. It is case sensitive.

Author Resource:-
Article From Interview Helper
New Members
select
Sign up
select
learn more
Affiliate Sign in
Affiliate Sign In
 
Nav Menu
Home
Login
Submit Articles
Submission Guidelines
Top Articles
Link Directory
About Us
Contact Us
Privacy Policy
RSS Feeds

Actions
Print This Article
Add To Favorites

 
Sponsors

 

 

All Rights Reserved Interview Helper