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

Define operators used in perl?

980


what are the three groups involved in information sharing?

935


Define perl scripting?

1028


How we can navigate the xml documents?

1063


What is use of ‘->’ symbol?

1058


Explain the meaning of closure in perl.

1091


How do I do fill_in_the_blank for each file in a directory?

1008


What are the advantages of perl programming?

1045


How to print escaping characters inside a string in perl?

952


Explain substr function in perl?

1086


How will you open a file in a write-only mode in perl?

986


Explain ivalue in perl?

1015


Where do we require ‘chomp’ and what does it mean?

1052


Explain perl.

981


Why we use CGI?

2589