l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
September 2: Social gathering
Next Installfest:
TBD
Latest News:
Aug. 18: Discounts to "Velocity" in NY; come to tonight's "Photography" talk
Page last updated:
2003 May 08 13:30

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] perl question - arrays and lists
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] perl question - arrays and lists



--mmR5Tf+WJGm+vTLg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, May 08, 2003 at 01:12:43PM -0700, Peter Jay Salzman wrote:
> what i've found is that @barfoo is no longer an array of lists.  the
> lists appear to be "flattened out".

  Yes, they should be.

> i know that arrays can hold lists, but i must not be doing it correctly.
> do i need to do this with references?

  Yes.

#! /usr/bin/perl -w

sub blah() {
  return (["a", "b"], ["c", "d"]);
}

sub foo()
{
   foreach (1..3)
   {
      push @array, ["a", "b"];
   }

   return @array;
}

@_ =3D foo;

foreach (@_) {
  print "$_ -> @$_\n";
}

--=20
GPG key: http://simons-clan.com/~msimons/gpg/msimons.asc
Fingerprint: 524D A726 77CB 62C9 4D56  8109 E10C 249F B7FA ACBE

--mmR5Tf+WJGm+vTLg
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE+urwX4Qwkn7f6rL4RAjvKAJ9N6FsKq1VcZ2r6fLOCySF00SnfKACfZawm
XrAm7aIBeGz/G/GEB5y+FvY=
=CZZp
-----END PGP SIGNATURE-----

--mmR5Tf+WJGm+vTLg--
_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech








LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
O'Reilly and Associates
For numerous book donations.