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 to connect cisco switch uisng perl script
Explain gmtime() function in perl?
If you want to empty an array then how would you do that?
How to convert strings into an array in perl?
What is perl? What is the basic command to print a string in perl?
Explain what is STDIN, STDOUT and STDERR?
What does the’$_’ symbol mean?
How do I read command-line arguments with Perl?
How to read from a pipeline with Perl
What does a die() function do in perl?
Write an example explaining the use of symbol tables.
Comment on the scope of variables in perl.
Explain 'grep' function.
Explain grooving and shortening of arrays?
Write the program to process a list of numbers.