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
How many types of operators are used in the Perl?
what are the three groups involved in information sharing?
What is the difference between use and require in perl?
Explain the meaning of perl one-liner?
Explain regular expression in perl?
Why do you use Perl?
How can we create perl programs in unix, windows nt, macintosh and os/2 ?
Explain gmtime() function in perl?
How to dereference a reference?
Why we use CGI?
What are the steps involved when the cgi program starts running?
What rules must be followed by modules in perl.
In Perl, what is grep function used for?
Define say() function in perl?
Explain the difference between "my" and "local" variable scope declarations. ?