What is the difference between $array[1] and @array[1]?
Answer Posted / 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 |
Post New Answer View All Answers
What are scalars in perl?
How many types of variable in perl?
Enlist the advantages of using c over perl?
Differentiate between arrays and list in perl.
What is the different between array and hash in perl programming?
What does cgi program store?
What does undef function in perl?
Explain lexical variables.
Write syntax to use grep function?
What is goto statement in perl?
Explain the functioning of conditional structures in perl.
What are perl array functions?
When does circular reference occur?
Why do you use Perl?
Why to use perl scripting?