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
What are prefix dereferencer? List them.
How will you access an element of a perl array?
What is the difference between single (') and double (") quote in a string in perl?
What are the various uses of perl?
What does init 5 and init 0 do?
How can you create anonymous subroutines?
What are the benefits of perl in using it as a web-based application?
What can be done for efficient parameter passing in perl?
Define operators used in perl?
Write a cgi program to show the header part?
What are the reasons that cookie server can’t handle multiple connections?
How do I sort a hash by the hash key?
How do I pass a command line argument in perl?
What are the various flags/arguments that can be used while executing a perl program?
What is the importance of perl warnings?