develooper Front page | perl.perl5.porters | Postings from March 2003

[perl #21765] $s = ""; $n = @a = split(/,/, $s); results in undef $n

Thread Next
From:
perlbug-followup
Date:
March 31, 2003 18:30
Subject:
[perl #21765] $s = ""; $n = @a = split(/,/, $s); results in undef $n
Message ID:
rt-21765-54391.11.8768140578591@bugs6.perl.org
# New Ticket Created by  wab@agere.com 
# Please include the string:  [perl #21765]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=21765 >



This is a bug report for perl from wab@agere.com,
generated with the help of perlbug 1.34 running under perl v5.8.0.


-----------------------------------------------------------------
[Please enter your report here]

The following code:
   $s = "";
   $n = @a = split(/,/, $s);
   print "a=@a n=$n\n";

produces:
   a= n=

But I expect n=0.

I get the expected result if I change the code from
   $n = @a = split(/,/, $s);
to
   @a = split(/,/, $s);
   $n = @a;

I also get the expected result if I predefine @a as shown below:
   my @a;
   $n = @a = split(/,/, $s);

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=medium
---
Site configuration information for perl v5.8.0:

Configured by models at Sat Mar 22 12:37:52 EST 2003.

Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
  Platform:
    osname=solaris, osvers=2.7, archname=sun4-solaris
    uname='sunos alsun130 5.7 generic_106541-19 sun4u sparc sunw,ultra-2 '
    config_args=''
    hint=previous, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='/sopt/Workshop6/SUNWspro/bin/cc', ccflags ='-DDEBUGGING -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O',
    cppflags='-DDEBUGGING -DDEBUGGING -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    ccversion='Sun WorkShop 6 2000/04/07 C 5.1', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='/sopt/Workshop6/SUNWspro/bin/cc', ldflags ='-L/sopt/Workshop6/SUNWspro/WS6/lib -L/usr/lib -L/usr/ccs/lib '
    libpth=/sopt/Workshop6/SUNWspro/WS6/lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -ldl -lm -lc
    perllibs=-lsocket -lnsl -ldl -lm -lc
    libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-KPIC', lddlflags='-G -L/sopt/Workshop6/SUNWspro/WS6/lib -L/usr/lib -L/usr/ccs/lib'

Locally applied patches:
    

---
@INC for perl v5.8.0:
    /home/models/common/lang/perl/lib/5.8.0/sun4-solaris
    /home/models/common/lang/perl/lib/5.8.0
    /home/models/common/lang/perl/lib/site_perl/5.8.0/sun4-solaris
    /home/models/common/lang/perl/lib/site_perl/5.8.0
    /home/models/common/lang/perl/lib/site_perl
    .

---
Environment for perl v5.8.0:
    HOME=/home/models
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH=/usr/lib:/sopt/SUNWspro/lib:/sopt/exptools/gnu/lib
    LOGDIR (unset)
    PATH=:/home/models/bin:/sopt/netscape/bin:/usr/openwin/bin:/sopt/SUNWspro/bin:/usr/ccs/bin:/usr/bin:/usr/sbin:/usr/ucb:/usr/ccs/bin:/sopt/local/bin:/sopt/dcs/bin:/sopt/addpath/bin:/usr/bin:/usr/ucb:/usr/local/bin:/sopt/exptools/bin:/sopt/exptools/gnu/bin:/sopt/Acrobat3/bin:/home/alctest/access.shells:/home/ads_beta/access.shells:/home/ddts/sol2x_bin:/home/models/bin/perltidy:/home/wab/bin
    PERL_BADLANG (unset)
    SHELL=/bin/ksh


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