From: Gurusamy Sarathy Date: Wed, 22 Mar 2000 20:04:01 +0000 (+0000) Subject: perlsyn.pod nit (from Tom Christiansen) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=96f2dc66fad1b386f43884f515103adf2c3eaf29;p=p5sagit%2Fp5-mst-13.2.git perlsyn.pod nit (from Tom Christiansen) p4raw-id: //depot/perl@5891 --- diff --git a/pod/perlsyn.pod b/pod/perlsyn.pod index 484af52..724ba12 100644 --- a/pod/perlsyn.pod +++ b/pod/perlsyn.pod @@ -324,7 +324,7 @@ Examples: for (@ary) { s/foo/bar/ } - foreach my $elem (@elements) { + for my $elem (@elements) { $elem *= 2; } @@ -353,8 +353,8 @@ Here's how a C programmer might code up a particular algorithm in Perl: Whereas here's how a Perl programmer more comfortable with the idiom might do it: - OUTER: foreach my $wid (@ary1) { - INNER: foreach my $jet (@ary2) { + OUTER: for my $wid (@ary1) { + INNER: for my $jet (@ary2) { next OUTER if $wid > $jet; $wid += $jet; } @@ -525,7 +525,7 @@ The C-EXPR form expects a label name, whose scope will be resolved dynamically. This allows for computed Cs per FORTRAN, but isn't necessarily recommended if you're optimizing for maintainability: - goto ("FOO", "BAR", "GLARCH")[$i]; + goto(("FOO", "BAR", "GLARCH")[$i]); The C-&NAME form is highly magical, and substitutes a call to the named subroutine for the currently running subroutine. This is used by