Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.85k stars 527 forks source link

perlsyn.pod and continue blocks with foreach #126

Closed p5pRT closed 20 years ago

p5pRT commented 24 years ago

Migrated from rt.perl.org#930 (status was 'resolved')

Searchable as RT930$

p5pRT commented 24 years ago

From desar@club-internet.fr

  The following compound statements may be used to control   flow​:

  if (EXPR) BLOCK   if (EXPR) BLOCK else BLOCK   if (EXPR) BLOCK elsif (EXPR) BLOCK ... else BLOCK   LABEL while (EXPR) BLOCK   LABEL while (EXPR) BLOCK continue BLOCK   LABEL for (EXPR; EXPR; EXPR) BLOCK   LABEL foreach VAR (LIST) BLOCK   LABEL BLOCK continue BLOCK

which seems to say you cannot write statements such

  LABEL foreach VAR (LIST) BLOCK continue BLOCK

although it seems to work perfectly​:

  my $i=100;   for(1\,2\,3\,4\,5) {   $_ % 2   or next;   print "$_\n"   } continue { $i++ }   print "=>$i"

compiles and correctly outputs

1 3 5 =>105

Is it an 'accidental' feature (I find *very* useful) or a missing line in perlsyn.pod ?

-- perl -V

This is perl\, version 5.005_03 built for i686-linux-thread

Copyright 1987-1999\, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the GNU General Public License\, which may be found in the Perl 5.0 source kit.

Complete documentation for Perl\, including FAQ lists\, should be found on this system using `man perl' or `perldoc perl'. If you have access to the Internet\, point your browser at http​://www.perl.com/\, the Perl Home Page.

[root@​fdesar /root]# perl -V Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration​:   Platform​:   osname=linux\, osvers=2.0.36\, archname=i686-linux-thread   uname='linux fdesar 2.0.36 #5 sun nov 29 14​:21​:28 cet 1998 i686 unknown '   hint=recommended\, useposix=true\, d_sigaction=define   usethreads=define useperlio=undef d_sfio=undef   Compiler​:   cc='cc'\, optimize='-O2'\, gccversion=2.7.2.3   cppflags='-D_REENTRANT -Dbool=char -DHAS_BOOL -I/usr/local/include'   ccflags ='-D_REENTRANT -Dbool=char -DHAS_BOOL -I/usr/local/include'   stdchar='char'\, d_stdstdio=define\, usevfork=false   intsize=4\, longsize=4\, ptrsize=4\, doublesize=8   d_longlong=define\, longlongsize=8\, d_longdbl=define\, longdblsize=12   alignbytes=4\, usemymalloc=n\, prototype=define   Linker and Libraries​:   ld='cc'\, ldflags =' -L/usr/local/lib'   libpth=/usr/local/lib /lib /usr/lib   libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lpthread -lc -lposix -lcrypt   libc=\, so=so\, useshrplib=false\, libperl=libperl.a   Dynamic Linking​:   dlsrc=dl_dlopen.xs\, dlext=so\, d_dlsymun=undef\, ccdlflags='-rdynamic'   cccdlflags='-fpic'\, lddlflags='-shared -L/usr/local/lib'

Characteristics of this binary (from libperl)​:   Built under linux   Compiled at Mar 29 1999 16​:01​:39   @​INC​:   /usr/lib/perl5/5.00503/i686-linux-thread   /usr/lib/perl5/5.00503   /usr/lib/perl5/site_perl/5.005/i686-linux-thread   /usr/lib/perl5/site_perl/5.005   . -- François Désarménien

Membre de l'ACM \<http​://www.acm.org> Membre de l'AFUL \<http​://www.aful.org>

p5pRT commented 23 years ago

From [Unknown Contact. See original ticket]

fixed in perl-current

p5pRT commented 20 years ago

From The RT System itself

fixed in perl-current