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

Explain perl.

936


What is the difference between exec and system?

1078


How to copy a file in perl?

970


Which operator in perl is used for the concatenation of two strings?

992


Why is it hard to call this function: sub y { "because" } ?

947


How can we create perl programs in unix, windows nt, macintosh and os/2 ?

880


Write a program that shows the distinction between child and parent process?

928


what are prefix dereferencer and list them out?

1027


What is stdin in perl?

956


What is the usage of -i and 0s options?

976


Show the use of sockets for the server and client side of a conversation?

882


What is v-strings?

1056


What is subroutine in perl?

939


What is the purpose of goto expr statement?

907


What are the arguments and what do they mean in perl programming?

991