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

[perl #22161] Reverse array slice assignment ( @ba[0..1] = @ab[1..0] ) doesn't work (?)

Thread Next
From:
Dahl, Art
Date:
May 9, 2003 06:48
Subject:
[perl #22161] Reverse array slice assignment ( @ba[0..1] = @ab[1..0] ) doesn't work (?)
Message ID:
rt-22161-56995.2.42703431266776@bugs6.perl.org
# New Ticket Created by  "Dahl, Art" 
# Please include the string:  [perl #22161]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=22161 >


This is a bug report for perl from XAHC004@PWMASTER,
generated with the help of perlbug 1.28 running under perl v5.6.0.


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


If the subscripts on an array slice decrease (@array_slice[A..B], A > B),
the assignment of that slice to another array or slice doesn't seem
to occur (the left-hand side of the assignment is null):

print "This (\@ba[0..1] = \@ab[0..1]) works:\n";
@ab = (10, 20);
@ba = ();
@ba[0..1] = @ab[0..1];
print "\@ab = $ab[0] $ab[1]\n";
print "\@ba = $ba[0] $ba[1]\n\n";

print "This (\@ba[0,1] = \@ab[1,0]) works:\n";
@ab = (10, 20);
@ba = ();
@ba[0,1] = @ab[1,0];
print "\@ab = $ab[0] $ab[1]\n";
print "\@ba = $ba[0] $ba[1]\n\n";

print "But this (\@ba[0..1] = \@ab[1..0]) doesn't work:\n";
@ab = (10, 20);
@ba = ();
@ba[0..1] = @ab[1..0];
print "\@ab = $ab[0] $ab[1]\n";
print "\@ba = $ba[0] $ba[1]\n";


This happens on both:
 perl, version 5.005_02 built for sun4-solaris
 perl, v5.6.0 built for MSWin32-x86-multi-thread

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

Configured by Administrator at Fri Dec 15 16:26:56 2000.

Summary of my perl5 (revision 5 version 6 subversion 0) configuration:
  Platform:
    osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    usethreads=undef use5005threads=undef useithreads=define
usemultiplicity=define
    useperlio=undef d_sfio=undef uselargefiles=undef 
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='cl', optimize='-O1 -MD -DNDEBUG', gccversion=
    cppflags='-DWIN32'
    ccflags ='-O1 -MD -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT
-DHAVE_DES_FCRYPT  -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
-DPERL_MSVCRT_READFIX'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=4
    alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='link', ldflags ='-nologo -nodefaultlib -release
-libpath:"C:\Perl\lib\CORE"  -machine:x86'
    libpth="C:\Perl\lib\CORE"
    libs=  oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib
uuid.lib wsock32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib
msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl56.lib
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -release
-libpath:"C:\Perl\lib\CORE"  -machine:x86'

Locally applied patches:
    ACTIVEPERL_LOCAL_PATCHES_ENTRY

---
@INC for perl v5.6.0:
    K:\Prod\share\perl\lib
    K:\Prod\WNT\lib\perl
    C:/Perl/lib
    C:/Perl/site/lib
    .

---
Environment for perl v5.6.0:
    HOME=h:/
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
 
PATH=C:\WINNT\SYSTEM32;C:\WINNT;K:\PROD\WNT\ORACLE8\ORANT\BIN;K:\PROD\WNT\OR
ACLE8\ORAWIN\BIN;K:\PROD\WNT\LIB;K:\PROD\Share\Bin;K:\PROD\WNT\Bin;\\dfssvr\
dfs_root\pwapps\prod\wnt\lsf\lsf42\bin;C:\Program Files\BIN;C:\Program
Files\MPIPro\bin;C:\perl\bin;C:\Program Files\Winzip;D:\Program
Files\Microsoft Visual Studio\Common\Tools;D:\Program Files\Microsoft Visual
Studio\Common\Msdev98\BIN;D:\Program Files\Microsoft Visual
Studio\DF98\BIN;D:\Program Files\Microsoft Visual
Studio\VC98\BIN;C:\WINNT\SYSTEM32\WBEM;C:\SYSMGT\TNGSD\BIN;C:\SYSMGT\CA_APPS
W\VIRUSS~1;C:\SYSMGT\TNGEAV;K:\prod\wnt\cygnus\cygwin-b20\H-i586-cygwin32\bi
n
    PERLLIB=K:\Prod\share\perl\lib;K:\Prod\WNT\lib\perl
    PERLPATH=C:\Perl\bin
    PERL_BADLANG (unset)
    SHELL=C:\NUTCROOT\mksnt\sh.exe



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