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 |
Explain goto name?
What package you use to create a windows services?
What does length(%HASH) produce if you have thirty-seven random keys in a newly created hash?
What is the peculiarity of returning values by subroutines in perl?
Why to use perl?
What is the importance of perl warnings?
What does the’$_’ symbol mean?
If you want to empty an array then how would you do that?
What are some of the key features of objects in perl?
How can the user execute a long command repeatedly without typing it again and again?
How do I sort a hash by the hash key?
Why is it hard to call this function: sub y { "because" } ?