Perl / perl5

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

documentation bug: Regexp ref type not mentioned #45

Closed p5pRT closed 20 years ago

p5pRT commented 24 years ago

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

Searchable as RT847$

p5pRT commented 24 years ago

From qz@qz.to

Neither perlop.pod nor perlfunc.pod mentions that qr// returns a ref to the compiled regular expression. These patches fix that. Additionally\, I've expanded the explanation of ref() to comment on how to create each type of reference.

Inline Patch ```diff --- perlfunc.pod.orig Fri Mar 5 14:10:56 1999 +++ perlfunc.pod Mon Jun 7 15:10:48 1999 @@ -2781,6 +2781,13 @@ HASH CODE GLOB + Regexp + +References of types REF, ARRAY, HASH, and GLOB are simple to get with the +C<\> referencing operator. References to CODE come from anonymous +function declarations (see C). SCALAR references come from such +constructs as C<$sref = \substr($_, 3, 4);>. References to regular +expressions are the printable results returned by the C operator. If the referenced object has been blessed into a package, then that package name is returned instead. You can think of C as a C operator. --- perlop.pod.orig Fri Mar 5 14:10:56 1999 +++ perlop.pod Mon Jun 7 15:21:21 1999 @@ -910,7 +910,9 @@ =item qr/STRING/imosx A string which is (possibly) interpolated and then compiled as a -regular expression. The result may be used as a pattern in a match +regular expression. The result is a printable string that is a +reference to the compiled regular expression. It may be used as +a pattern in a match $re = qr/$pattern/; $string =~ /foo${re}bar/; # can be interpolated in other patterns ```
Perl Info ``` Site configuration information for perl 5.00502: Configured by root at Thu Mar 4 19:46:56 EST 1999. Summary of my perl5 (5.0 patchlevel 5 subversion 2) configuration: Platform: osname=linux, osvers=2.0.30, archname=i586-linux uname='linux qz 2.0.30 #1 wed jun 4 15:02:33 edt 1997 i586 unknown ' hint=recommended, useposix=true, d_sigaction=define usethreads=undef useperlio=undef d_sfio=undef Compiler: cc='cc', optimize='-O2', gccversion=2.8.0 cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include -DDEBUGGING' ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include -DDEBUGGING' 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=-lndbm -lgdbm -ldb -ldl -lm -lc libc=/lib/libc.so.5.3.12, so=so, useshrplib=true, libperl=libperl.so Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5/5.00502/i586-linux/CORE' cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib' Locally applied patches: @INC for perl 5.00502: /usr/lib/perl5/5.00502/i586-linux /usr/lib/perl5/5.00502 /usr/lib/perl5/site_perl/5.005/i586-linux /usr/lib/perl5/site_perl/5.005 . Environment for perl 5.00502: HOME=/home/qz LANG (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/usr/local/bin:/usr/bin:/bin:.:/sbin:/usr/sbin:/usr/X11R6/bin:/usr/bin/mh PERL_BADLANG (unset) SHELL=/bin/ksh ```