Perl Programming Question:

Download Job Interview Questions and Answers PDF

Assume that $ref refers to a scalar, an array, a hash or to some nested data structure. Explain the following statements:

Perl Programming Interview Question
Perl Programming Interview Question

Answer:

$$ref; # returns a scalar
$$ref[0]; # returns the first element of that array
$ref- > [0]; # returns the first element of that array
@$ref; # returns the contents of that array, or number of elements, in scalar context
$&$ref; # returns the last index in that array
$ref- > [0][5]; # returns the sixth element in the first row
@{$ref- > {key}} # returns the contents of the array that is the value of the key "key"

Download Perl Programming Interview Questions And Answers PDF

Previous QuestionNext Question
What happens to objects lost in "unreachable" memory..... ?How do you match one letter in the current locale?