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
Elaborate on perl bite-wise operators.
Write syntax to use grep function?
What does Perl do if you try to exploit the execve(2) race involving setuid scripts?
what are prefix dereferencer and list them out?
Who created perl?
How many types of primary data structures in Perl and what do they mean?
Explain what is the scalar data and scalar variables in Perl?
How can the user execute a long command repeatedly without typing it again and again?
What are some common methods to all handles in perl?
How can you define “my” variables scope in Perl and how it is different from “local” variable scope?
What is the use of -t?
Explain 'grep' function.
How many types of operators are used in the Perl?
What does length(%HASH) produce if you have thirty-seven random keys in a newly created hash?
How to turn on Perl warnings? Why is that important?