What is the difference between $array[1] and @array[1]?
Answer / kiruthikau
$array[1] represents a scalar value.
@array[1] represents array slicing.
@array[1] returns a list with one scalar value.
We should use $ when we want a scalar value.
If we want a list we need to use @.
If we use 'use warnings' then @array[1] will give the warnings
like ,Scalar value @array[1] better written as $array[1].
| Is This Answer Correct ? | 3 Yes | 0 No |
What are the characteristics of a project that is well suited to Perl?
Explain the default scope of variables in perl?
What is 'rollback' command in perl?
What does redo statement do in perl?
How can arrays be tied?
What is use of ‘->’ symbol?
How can I implement the function overloading in Perl ? I read about the operator overloading, I do not know how to implement the function overloading. Thanks in advance ?
You want to read command-line arguements with perl. How would you do that?
What is the use of strict?
What are the various file operations in perl. Explain with example.
Does Perl have reference type?
What are the advantages and disadvantages of perl language?