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 'grep' function.

920


Can inheritance be used in perl?

924


How to deleting an existing file in perl programming?

846


What is the use of -w, -t and strict in Perl?

939


How to code in perl to implement the tail function in unix?

881


Explain chop?

864


Where the command line arguments are stored and if you want to read command-line arguments with Perl, how would you do that?

1032


List the prefix dereferencer in Perl.

877


How will you get the count of parameters passed to a perl subroutine?

882


How to open a directory in perl?

1023


In Perl, there are some arguments that are used frequently. What are that arguments and what do they mean?

856


Explain about the applications of perl?

910


You want to print the contents of an entire array. How would you do that?

888


What are the arguements we normally use for perl interpreter?

904


What is the use of "stderr()"?

956