What is the difference between for & foreach, exec &
system?
Answer Posted / mukesh
for and foreach are alias of each other.But syntax is different.
e.g for(my $i = 0; $i < 3; ++$i){print $i}
e.g foreach my $i (0 .. 2){print $i}
i.e in foreach we can take always only array of elements or
range of elements.But in for we dont have to take the array
or range always.here we can provide condition of the loop
where it is not true for foreach.
| Is This Answer Correct ? | 28 Yes | 7 No |
Post New Answer View All Answers
You want to download the contents of a url with perl. How would you do that?
What is confess function in perl?
How to print escaping characters inside a string in perl?
what is the function of Return Value?
What is use of ‘->’ symbol?
What is perl scripting?
How many ways can we express string in Perl?
How will you create a file in perl?
How do I send e-mail from a Perl/CGI program on a Unix system?
Does Perl have objects? If yes, then does it force you to use objects? If no, then why?
Which functions in perl allows you to include a module file.
Difference between the variables in which chomp function work ?
What are the purpose of close(), getc() and read() functions?
How are parameters passed to subroutines in perl?
How we can navigate the xml documents?