develooper Front page | perl.perl5.porters | Postings from August 2001

[ID 20010827.004] qw// documentation says a list is created

Thread Next
From:
Ren Maddox
Date:
August 27, 2001 08:32
Subject:
[ID 20010827.004] qw// documentation says a list is created
Message ID:
200108271529.f7RFTkw24601@dhcp9-161.support.tivoli.com
This is a bug report for perl from ren@tivoli.com,
generated with the help of perlbug 1.33 running under perl v5.6.1.


-----------------------------------------------------------------
The documentation of qw// states that a list is created.  It needs
to be reworded in terms of context.  Here's one attempt:

       qw/STRING/

               Evaluates to a sequence of comma-separated,
               single-quoted sub-strings extracted out of STRING,
               using embedded whitespace as the delimiters.

               In list context, it can be understood as being roughly
               equivalent to:

                   split(' ', q/STRING/, -1);

               the difference being that it happens at compile time.

               In scalar context, it evaluates to the final sub-string
               of the sequence.

               So this expression:

                   qw(foo bar baz)

               is semantically equivalent to this one:

                   ('foo', 'bar', 'baz')

               in both list and scalar contexts (evaluating to a list
               of the three elements in list context and 'baz' in
               scalar context).

               Some frequently seen examples:

                   use POSIX qw( setlocale localeconv )
                   @EXPORT = qw( foo bar baz );

               A common mistake is to try to separate the words
               with comma or to put comments into a multi-line
               "qw"-string.  For this reason, the "use warnings"
               pragma and the -w switch (that is, the "$^W" vari
               able) produces warnings if the STRING contains the
               "," or the "#" character.

-----------------------------------------------------------------
---
Flags:
    category=docs
    severity=medium
---
Site configuration information for perl v5.6.1:

Configured by daves at Wed Jul  4 15:34:35 PDT 2001.

Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
  Platform:
    osname=linux, osvers=2.2.12-20smp, archname=i686-linux-thread-multi
    uname='linux molotok 2.2.12-20smp #1 smp mon sep 27 10:34:45 edt 1999 i686 unknown '
    config_args='-des -Dcc=gcc -Dcf_by=ActiveState -Dcf_email=ActivePerl@ActiveState.com -Uinstallusrbinperl -Dusethreads -Duseithreads -Dinc_version_list=5.6.0/$archname 5.6.0 -Dprefix=/usr/local/ActivePerl-5.6'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
    useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
  Compiler:
    cc='gcc', ccflags ='-D_REENTRANT -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-D_REENTRANT -fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lpthread -lc -lposix -lcrypt -lutil
    perllibs=-lnsl -ldl -lm -lpthread -lc -lposix -lcrypt -lutil
    libc=/lib/libc-2.1.2.so, 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'

Locally applied patches:
    ACTIVEPERL_LOCAL_PATCHES_ENTRY

---
@INC for perl v5.6.1:
    /usr/local/ActivePerl-5.6/lib/5.6.1/i686-linux-thread-multi
    /usr/local/ActivePerl-5.6/lib/5.6.1
    /usr/local/ActivePerl-5.6/lib/site_perl/5.6.1/i686-linux-thread-multi
    /usr/local/ActivePerl-5.6/lib/site_perl/5.6.1
    /usr/local/ActivePerl-5.6/lib/site_perl/5.6.0/i686-linux-thread-multi
    /usr/local/ActivePerl-5.6/lib/site_perl/5.6.0
    /usr/local/ActivePerl-5.6/lib/site_perl
    .

---
Environment for perl v5.6.1:
    HOME=/home/ren
    LANG=en_US
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/local/ActivePerl-5.6/bin:/home/ren/bin:/home/ren/perl:/home/ren/scripts:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/X11R6/bin:/usr/local/office52:/home/ren/bin:/usr/lpp/cmvc/bin:/net/snapper/opt/AusTextTools:.
    PERL_BADLANG (unset)
    SHELL=/bin/zsh


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About