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 is the use of 'ne' operator?
Perl regular expressions are greedy" what does this mean?
What does undef function in perl?
What are the options that can be used to avoid logic errors in perl?
Explain grooving and shortening of arrays?
Explain substr function in perl?
What are perl variables?
What is automatic error handling in perl?
How to change a directory in perl?
How to convert strings into an array in perl?
What are perl strings?
What is epoch time in perl?