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 'grep' function.
Can inheritance be used in perl?
How to deleting an existing file in perl programming?
What is the use of -w, -t and strict in Perl?
How to code in perl to implement the tail function in unix?
Explain chop?
Where the command line arguments are stored and if you want to read command-line arguments with Perl, how would you do that?
List the prefix dereferencer in Perl.
How will you get the count of parameters passed to a perl subroutine?
How to open a directory in perl?
In Perl, there are some arguments that are used frequently. What are that arguments and what do they mean?
Explain about the applications of perl?
You want to print the contents of an entire array. How would you do that?
What are the arguements we normally use for perl interpreter?
What is the use of "stderr()"?