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 ?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Which feature of perl provides code reusability?

968


Explain perl. When do you use perl for programming?

857


Explain perl one-liner?

940


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

869


How are parameters passed to subroutines in perl?

920


what are prefix dereferencer and list them out?

1014


What does the’$_’ symbol mean?

987


How will you create a file in perl?

970


What are hashes?

923


Explain lexical variables.

927


Write a program to show the process of spawning a child process

839


how to extract pin_code,phone_number,year from text file using regular expressions in perl

2221


How do you match one letter in the current locale?

1000


Distinguish my and local?

965


Mention the difference between die and exit in Perl?

1091