Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is goto statement in perl?

889


what are the three groups involved in information sharing?

830


What are the arguements we normally use for perl interpreter?

905


What is it meants by '$_'?

858


How to close a directory in perl?

870


what are steps to do to lock the sony ericsson mobile with password?

2139


explain the various functions/directives in perl that allow you to include/import a module. Also, state the differences between them.

811


How do I replace every character in a file with a comma?

924


What is a perl references?

860


Create a function that is only available inside the scope where it is defined ?

949


you are required to replace a char in a string and store the number of replacements. How would you do that?

859


How to know whether a key exists or not in perl?

916


Explain chomp?

862


How to prevent file truncation in perl?

936


What are scalar data and scalar variables?

1054