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

[perl #24716] ?: conditional as first arg to push() behaves inconsistently

Thread Next
From:
perlbug-followup
Date:
December 21, 2003 13:36
Subject:
[perl #24716] ?: conditional as first arg to push() behaves inconsistently
Message ID:
rt-3.0.7_01-24716-68651.5.006413077666@perl.org
# New Ticket Created by  ed@budvar.future-i.net 
# Please include the string:  [perl #24716]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=24716 >



This is a bug report for perl from ed@budvar.future-i.net,
generated with the help of perlbug 1.34 running under perl v5.8.2.


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

% perl -e 'push 1 ? @a : @b, 77; print "a=@a\nb=@b\n"'
a=77
b=
% perl -e 'push 0 ? @a : @b, 77; print "a=@a\nb=@b\n"'
a=
b=77

So far so good.  But

% perl -e 'push time() ? @a : @b, 77; print "a=@a\nb=@b\n"'
Type of arg 1 to push must be array (not null operation) at -e line 1, near "77;"
Execution of -e aborted due to compilation errors.

Why isn't time() considered an equally good Boolean expression as 0 or
1?

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

Configured by ed at Sat Nov 29 20:12:13 GMT 2003.

Summary of my perl5 (revision 5.0 version 8 subversion 2) configuration:
  Platform:
    osname=linux, osvers=2.2.19-6.2.12.1rs, archname=i686-linux
    uname='linux budvar.future-i.net 2.2.19-6.2.12.1rs #1 sat nov 3 02:42:38 cst 2001 i686 unknown '
    config_args='-de -Dprefix=/home/ed'
    hint=recommended, 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='cc', ccflags ='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
    optimize='-O2',
    cppflags='-fno-strict-aliasing -I/usr/local/include -I/usr/include/gdbm'
    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, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lbind -lnsl -lgdbm -ldl -lm -lcrypt -lutil -lc
    perllibs=-lbind -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/libc-2.2.4.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.2.4'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    

---
@INC for perl v5.8.2:
    /home/ed/lib/perl5/5.8.2/i686-linux
    /home/ed/lib/perl5/5.8.2
    /home/ed/lib/perl5/site_perl/5.8.2/i686-linux
    /home/ed/lib/perl5/site_perl/5.8.2
    /home/ed/lib/perl5/site_perl/5.8.2/i686-linux
    /home/ed/lib/perl5/site_perl/5.8.2/i386-linux
    /home/ed/lib/perl5/site_perl/5.8.2/i686-linux
    /home/ed/lib/perl5/site_perl/5.8.2
    /home/ed/lib/perl5/site_perl
    /home/ed/lib/perl5/5.8.2/i686-linux
    /home/ed/lib/perl5/5.8.2
    /home/ed/lib/perl5/site_perl/5.8.2/i686-linux
    /home/ed/lib/perl5/site_perl/5.8.2
    /home/ed/lib/perl5/site_perl
    .

---
Environment for perl v5.8.2:
    HOME=/home/ed
    LANG=en_US
    LANGUAGE (unset)
    LD_LIBRARY_PATH=/home/ed/lib:/home/ed/wine/inst/lib:/usr/local/lib
    LOGDIR (unset)
    PATH=/home/ed/bin:/home/ed/bin/i686-pc-linux-gnu:/home/ed/wine/inst/bin:/home/ed/lib/ant/bin:/bin:/usr/bin:/usr/local/maple/bin:/usr/sbin:/sbin:/opt/kde/bin:/usr/X11R6/bin:/usr/local/bin:/usr/local/X11/bin:/usr/krb5/bin:/usr/athena/bin:/opt/IBMJava2-13/bin:/usr/local/jdk1.2.2/bin:/usr/share/smlnj/bin:/usr/games:/usr/kerberos/bin:/usr/kerberos/sbin:/usr/libexec/openssh:/usr/local/java/bin
    PERL5LIB=/home/ed/lib/perl5/5.8.2:/home/ed/lib/perl5/site_perl/5.8.2:/home/ed/lib/perl5/site_perl/5.8.2/i686-linux:/home/ed/lib/perl5/site_perl/5.8.2/i386-linux:/home/ed/lib/perl5/site_perl
    PERL_BADLANG (unset)
    SHELL=/bin/bash

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