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

\(@foo) vs. \(@foo, @bar)

Thread Next
From:
Jeff Pinyan
Date:
March 17, 2000 10:34
Subject:
\(@foo) vs. \(@foo, @bar)
Message ID:
Pine.GSO.4.21.0003171327500.17415-100000@crusoe.crusoe.net
Ok, WHEN did this change about \'s distributive qualities?  I was under
the impression that:

  \@foo    # reference to @foo
  \(@foo)  # list of references to elements of @foo
  \(LIST)  # list of references to elements of LIST

So WHERE/WHY does this show up?

  DB<1> @a = (1,2);  @b = (3,4);

  DB<2> print \(@a)
SCALAR(0xc57e0)SCALAR(0x294fec)
  DB<3> print \(@a,@b)
ARRAY(0x294fe0)ARRAY(0x294ea8)
  DB<4> print \((@a),@b)
SCALAR(0xc57e0)SCALAR(0x294fec)ARRAY(0x294ea8)
  DB<5> print \(@a,(@b))
ARRAY(0x294fe0)SCALAR(0xc7414)SCALAR(0xc7420)
  DB<6> print \((@a),(@b))
SCALAR(0xc57e0)SCALAR(0x294fec)SCALAR(0xc7414)SCALAR(0xc7420)

That's some FUNNY list expansion going on.

Summary of my perl5 (5.0 patchlevel 5 subversion 2) configuration:
  Platform:
    osname=solaris, osvers=2.5.1, archname=sun4-solaris
    uname='sunos friday 5.5.1 generic_103640-22 sun4m sparc sunw,sparcstation-5 '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='/usr/local/bin/gcc', optimize='-O', gccversion=2.7.2.3
    cppflags='-I/usr/local/include'
    ccflags ='-I/usr/local/include'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='/usr/local/bin/gcc', ldflags =' -L/usr/local/lib -L/opt/gnu/lib'
    libpth=/usr/local/lib /opt/gnu/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -ldb -ldl -lm -lc -lcrypt
    libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib -L/opt/gnu/lib'


Characteristics of this binary (from libperl): 
  Built under solaris
  Compiled at Mar 24 1999 18:43:53
  @INC:
    /usr/local/lib/perl5/5.00502/sun4-solaris
    /usr/local/lib/perl5/5.00502
    /usr/local/lib/perl5/site_perl/5.005/sun4-solaris
    /usr/local/lib/perl5/site_perl/5.005
    .

-- 
MIDN 4/C PINYAN, NROTCURPI, US Naval Reserve             japhy@pobox.com
http://www.pobox.com/~japhy/                  http://pinyaj.stu.rpi.edu/
PerlMonth - An Online Perl Magazine            http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc.    http://www.perlarchive.com/


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