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 / mahendra ratnakar

Technically, there's no difference between for and foreach
other than some style issues.

One is an alias of another. You can do things like this

foreach (my $i = 0; $i < 3; ++$i)

{ # normally this is foreach print $i, "n";}


for my $i (0 .. 2)

{ # normally this is for print $i, "n";}


- exec runs the given process, switches to its name and
never returns while system forks off the given process,
waits for it to complete and then returns.

Is This Answer Correct ?    12 Yes 18 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain string comparison operators in perl.

1052


What is the usage of -i and 0s options?

1062


Explain subroutine in perl?

1006


Why we use CGI?

2589


How to merge two arrays in perl?

1108


How can you replace the characters from a string and save the number of replacements?

959


What is the difference between die and exit in perl?

1052


What are the two ways to get private values inside a subroutine?

968


Explain chop?

966


Which statement has an initialization, condition check and increment expressions in its body? Write a syntax to use that statement.

1074


What are the various file operations in perl. Explain with example.

1000


Which operator in perl is used for the concatenation of two strings?

1042


Write the program to process a list of numbers.

1046


what are prefix dereferencer and list them out?

1087


How do I replace every TAB character in a file with a comma?

1019