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 are the steps involved in reading a cgi script on the server?

0 Answers  


Which functions in perl allows you to include a module file.

0 Answers  


What is 'commit' command in perl?

0 Answers  


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

0 Answers  


How to replace perl array elements?

0 Answers  


What are the arguements we normally use for perl interpreter?

0 Answers  


What elements of the Perl language could you use to structure your code to allow for maximum re-use and maximum readability?

1 Answers  


How to implement a stack in Perl?

0 Answers  


What does `$result = f() .. g()' really return?

0 Answers  


How can I display all array element in which each element will display on next line in perl ?

0 Answers  


Why do you program in Perl?

4 Answers  


Explain what is STDIN, STDOUT and STDERR?

0 Answers  


Categories