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
Explain string comparison operators in perl.
What is the usage of -i and 0s options?
Explain subroutine in perl?
Why we use CGI?
How to merge two arrays in perl?
How can you replace the characters from a string and save the number of replacements?
What is the difference between die and exit in perl?
What are the two ways to get private values inside a subroutine?
Explain chop?
Which statement has an initialization, condition check and increment expressions in its body? Write a syntax to use that statement.
What are the various file operations in perl. Explain with example.
Which operator in perl is used for the concatenation of two strings?
Write the program to process a list of numbers.
what are prefix dereferencer and list them out?
How do I replace every TAB character in a file with a comma?