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
How can you replace the characters from a string and save the number of replacements?
How do you find the length of an array?
How do I read command-line arguments with Perl?
List the data types that Perl can handle?
Explain the use of 'my' keyword in perl?
What is v-strings?
Show the use of sockets for the server and client side of a conversation?
what are the strategies followed for multiple form interaction in cgi programs?
How can the user execute a long command repeatedly without typing it again and again?
Explain about typeglobs?
What is the difference between single (') and double (") quote in a string in perl?
Write a program to concatenate the $firststring and $secondstring and result of these strings should be separated by a single space.
Enlist the advantages of using c over perl?
Explain chomp, chop, cpan, tk.
How the interpreter is used in Perl?