develooper Front page | perl.perl5.porters | Postings from April 2000

[ID 20000424.006] split() returning incorrect number of fields

Thread Next
From:
Adam Moskowitz
Date:
April 24, 2000 14:49
Subject:
[ID 20000424.006] split() returning incorrect number of fields
Message ID:
200004242148.RAA39620@hawk-eg1

This is a bug report for perl from adamm@lbri.lionbioscience.com,
generated with the help of perlbug 1.20 running under perl 5.00404.


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

In the following program, I contend that split() should return the same
number of fields in both cases:

	my $str1 = "aaa:bbb:ccc:ddd:eee";
	my $str2 = "aaa:bbb:ccc:ddd:";
	my @w;

	@w = split(/:/, $str1);
	printf("scalar(\@w) = %d\n\n",scalar(@w));

	@w = split(/:/, $str2);
	printf("scalar(\@w) = %d\n",scalar(@w));

It doesn't. I'm pretty sure that this is neither the correct nor
expected behavior.

Thanx,
AdamM

[Please do not change anything below this line]
-----------------------------------------------------------------

---
Site configuration information for perl 5.00404:

Configured by scotth at Wed Dec  3 09:14:22 PST 1997.

Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration:
  Platform:
    osname=irix, osvers=6.5, archname=irix-n32
    uname='irix hoshi 6.5 11251326 ip22 '
    hint=recommended, useposix=true, d_sigaction=define
    bincompat3=y useperlio=define d_sfio=undef
  Compiler:
    cc='cc -n32 -mips3', optimize='-O3 -mips3', gccversion=
    cppflags='-D_BSD_SIGNALS -D_BSD_TYPES -D_BSD_TIME -OPT:Olimit=0:space=ON -DLANGUAGE_C -DEMBEDMYMALLOC'
    ccflags ='-D_BSD_SIGNALS -D_BSD_TYPES -D_BSD_TIME -woff 1009,1110,1184 -OPT:Olimit=0:space=ON -DLANGUAGE_C -DEMBEDMYMALLOC'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    voidflags=15, castflags=0, d_casti32=define, d_castneg=define
    intsize=4, alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='cc', ldflags ='-n32'
    libpth=/usr/lib32 /lib32
    libs=-lm
    libc=/usr/lib32/libc.so, so=so
    useshrplib=true, libperl=libperl.so.4.4
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=''
    cccdlflags=' ', lddlflags='-n32 -mips3 -shared'

Locally applied patches:
	

---
@INC for perl 5.00404:
	/usr/share/lib/perl5/irix-n32/5.00404
	/usr/share/lib/perl5
	/usr/share/lib/perl5/site_perl/irix-n32
	/usr/share/lib/perl5/site_perl
	/usr/share/lib/perl5/sgi_perl
	.

---
Environment for perl 5.00404:
    HOME=/home/adamm
    LANG=C
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=.:/home/adamm/bin:/usr/bin:/usr/bsd:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin:/etc:/usr/etc:/usr/local/etc:/opt/MIPSpro/bin:/opt/bin:/usr/java/bin:/usr/pcp/bin:/usr/ssm/bin
    PERL_BADLANG (unset)
    SHELL=/sbin/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