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 for & foreach, exec &
system?

Answer Posted / mukesh

for and foreach are alias of each other.But syntax is different.

e.g for(my $i = 0; $i < 3; ++$i){print $i}
e.g foreach my $i (0 .. 2){print $i}

i.e in foreach we can take always only array of elements or
range of elements.But in for we dont have to take the array
or range always.here we can provide condition of the loop
where it is not true for foreach.

Is This Answer Correct ?    28 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Elaborate on perl bite-wise operators.

908


Write syntax to use grep function?

968


What does Perl do if you try to exploit the execve(2) race involving setuid scripts?

945


what are prefix dereferencer and list them out?

1033


Who created perl?

917


How many types of primary data structures in Perl and what do they mean?

1409


Explain what is the scalar data and scalar variables in Perl?

950


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

930


What are some common methods to all handles in perl?

921


How can you define “my” variables scope in Perl and how it is different from “local” variable scope?

1129


What is the use of -t?

963


Explain 'grep' function.

976


How many types of operators are used in the Perl?

1034


What does length(%HASH) produce if you have thirty-seven random keys in a newly created hash?

1018


How to turn on Perl warnings? Why is that important?

1063