X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperlsyn.pod;h=aad4efd2f7718fbde5c7b0aa8c9d7a77ccbb31f6;hb=ec38d36ccc38aad33e07cbbbf1e8816341de661d;hp=e6b420e5db9c19e323cae66eccb153f77fc7980d;hpb=22d4bb9ccb8701e68f9243547d7e3a3c55f70908;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perlsyn.pod b/pod/perlsyn.pod index e6b420e..aad4efd 100644 --- a/pod/perlsyn.pod +++ b/pod/perlsyn.pod @@ -263,7 +263,7 @@ available. Replace any occurrence of C by C. =head2 For Loops -Perl's C-style C loop works exactly like the corresponding C loop; +Perl's C-style C loop works like the corresponding C loop; that means that this: for ($i = 1; $i < 10; $i++) { @@ -279,8 +279,10 @@ is the same as this: $i++; } -(There is one minor difference: The first form implies a lexical scope -for variables declared with C in the initialization expression.) +There is one minor difference: if variables are declared with C +in the initialization section of the C, the lexical scope of +those variables is exactly the C loop (the body of the loop +and the control sections). Besides the normal array index looping, C can lend itself to many other interesting applications. Here's one that avoids the