home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!ira.uka.de!smurf.sub.org!ppcnet!ppcger!Sepp
- Message-ID: <gkqABG@ppcger.ppc.sub.org>
- From: Sepp@ppcger.ppc.sub.org (Josef Wolf)
- Newsgroups: comp.lang.perl
- Subject: Re: How do you simulate a multidimensional list?
- Distribution: world
- Organization: PPC Germersheim, Germany
- Date: 22 Aug 92 13:52:20 GMT
- References: <1992Aug06.221229.265281@cs.cmu.edu> <1992Aug08.215718.25342@Celestial.COM> <1992Aug11.121132.13920@id.dth.dk>
- Lines: 42
-
- In <1992Aug11.121132.13920@id.dth.dk> ej@id.dth.dk (Erik Johansen) writes:
- ] bill@Celestial.COM (Bill Campbell) writes:
- ] >:I understand that perl doesn't directly support multidimentional
- ] >:arrays (or lists), but that there's some way to simulate it. I don't
- ] >:know how to do it. I have a perl program that manipulates several sets
- ] >:of data, where I represent each set as a list. I'd like to make a list
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^
- ] >:of the lists, and use foreach over the list of lists. Below is a
- ^^^^^^^^^^^^
- ] >:simplified example of what I'd like.
-
- ] >can use a similar expression a{"$i,$j,$k"}.
-
- ] The quotes are not needed just say $a{ $i, $j, $k } then Perl
-
- I don't thik this are the answers the original poster was searching for.
- I think he's searching for something like:
-
- @list1 = ("a1", "b1", "c1", "d1");
- @list2 = ("a2", "b2", "c2", "d2");
- @list3 = ("a3", "b3", "c3", "d3");
- @list4 = ("a4", "b4", "c4", "d4");
-
- @biglist = ("list1", "list2", "list3", "list4");
-
- foreach $list (@biglist) {
- local (*alias) = $list;
- foreach (@alias) {
- print "$_\n";
- }
- }
-
- Disclaimer: never tested this, because perl not available yet for this
- machine :-(
-
- Greetings
- Sepp
-
- --
- | Josef Wolf, Germersheim, Germany aka sepp@ppcger.ppc.sub.org |
- | +49 7274 8048 USR HST-DS 300-14400 V32/V32bis V42/V42bis/HST 24 Hours |
- | ...und wieviel brave Deutsche haben wieder nichts geschnallt... (Marius) |
-