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...


while(my($key, $value) = each(%hash) ) { print "$key =>
$value\n"; }

my($key, $value); while(($key, $value) = each(%hash) ) {
print "$key => $value\n"; }


What is the different between these two code in case of "my"
usage ?



while(my($key, $value) = each(%hash) ) { print "$key => $value\n"; } my($key, $valu..

Answer / sourisengupta

case 1:

by decalring "my" we are making the variable local.
So you cant access the value of those variable from the
outsite of that block.

case 2:

here you can access the value of the code from the
outside of that code.

"my" is generally used to protect the variable from
mingling.

Is This Answer Correct ?    4 Yes 0 No

Post New Answer

More CGI Perl Interview Questions

What is the use of strict?

0 Answers  


How to convert strings into an array in perl?

0 Answers  


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

0 Answers  


Explain perl. When do you use perl for programming?

0 Answers  


How can you create an object of a class in a package?

4 Answers   IBM,


How interpreter is used in perl?

0 Answers  


How to read a directory in perl?

0 Answers  


What does perl do in linux?

0 Answers  


What is the importance of perl warnings?

0 Answers  


what is the function of Return Value?

0 Answers  


What are some of the key features of objects in perl?

0 Answers  


Assuming both a local($var) and a my($var) exist, what's the difference between ${var} and ${"var"}?

0 Answers  


Categories