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

How can you create anonymous subroutines?

864


Can inheritance be used in perl? Explain with the help of an example.

901


How can the user execute a long command repeatedly without typing it again and again?

857


What are some common methods to all handles in perl?

885


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

871


What are the steps involved when the cgi program starts running?

857


List the prefix dereferencer in Perl.

877


What is perl unshift array function?

941


How to do comment in perl?

906


Remove the duplicate data from @array=(“perl”,”php”,”perl”,”asp”)

926


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

809


Write an example explaining the use of symbol tables.

898


What are arrays in perl?

912


What are prefix dereferencer? List them.

914


List all the features of perl programming?

848