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
Write a program that shows the distinction between child and parent process?
How to renaming a file in perl programming?
Explain the different types of data perl can handle.
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 ?
What does file test operators do in perl?
What is the different between array and hash in perl programming?
Explain ivalue?
How to convert strings into an array in perl?
How to open and read data files with Perl
What syntax is used for grep() function?
How do I send e-mail from a Perl/CGI program on a Unix system?
How to merge two arrays in perl?
Comment on data types and variables in perl.
Is there any way to add two arrays together?
What are the advantages and disadvantages of perl language?