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
Define operators used in perl?
what are the three groups involved in information sharing?
Define perl scripting?
How we can navigate the xml documents?
What is use of ‘->’ symbol?
Explain the meaning of closure in perl.
How do I do fill_in_the_blank for each file in a directory?
What are the advantages of perl programming?
How to print escaping characters inside a string in perl?
Explain substr function in perl?
How will you open a file in a write-only mode in perl?
Explain ivalue in perl?
Where do we require ‘chomp’ and what does it mean?
Explain perl.
Why we use CGI?