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 are scalars in perl?

902


How many types of variable in perl?

1015


Enlist the advantages of using c over perl?

869


Differentiate between arrays and list in perl.

951


What is the different between array and hash in perl programming?

881


What does cgi program store?

857


What does undef function in perl?

891


Explain lexical variables.

896


Write syntax to use grep function?

918


What is goto statement in perl?

897


Explain the functioning of conditional structures in perl.

886


What are perl array functions?

1022


When does circular reference occur?

860


Why do you use Perl?

928


Why to use perl scripting?

938