RE: Help with Array of Arrays

2011-03-08 Thread Thurn, Martin (TASC)
The normal (Perlish, elegant) way of doing list references would be as follows: # Save our place. push @stack, [$i, $curlvl, \@thisBOM]; ... # Now, recover where we left off. ($i, $curlvl, $raBOM) = @{pop @stack}; ... print $i: @{$raBOM-[$i]}\n; I believe it has the added bonus of not copying

RE: Help with Array of Arrays

2011-03-07 Thread Greg Aiken
if you are not in control of the base sql query, then disregard this comment... however if you are in control of the sql query that executes to oracle, you might want to see how oracles 'connect by' function might be able to help you handle the hierarchical nature of the relationship. perhaps a

RE: Help with Array of Arrays

2011-03-07 Thread Ken Cornetet
...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Greg Aiken Sent: Monday, March 07, 2011 11:07 AM To: bbre...@stellarmicro.com; perl-win32-users@listserv.ActiveState.com Subject: RE: Help with Array of Arrays if you are not in control of the base sql query

RE: Help with Array of Arrays

2011-03-07 Thread Meir Guttman
...@stellarmicro.com; perl-win32-users@listserv.ActiveState.com Subject: RE: Help with Array of Arrays if you are not in control of the base sql query, then disregard this comment... however if you are in control of the sql query that executes to oracle, you might want to see how oracles 'connect

Re: Help with array of arrays!

2004-10-13 Thread David Greenberg
my @array = map { [$_:, 1, 2, 3] } (0..3); foreach (@array) { print join (', ', @{$_}) . \n; } HTH, David On Wed, 13 Oct 2004 14:44:06 +0100, Beckett Richard-qswi266 [EMAIL PROTECTED] wrote: Guys, This script: use strict; use warnings; my @array; for (0..3) { push @array, [$_:,

RE: Help with array of arrays!

2004-10-13 Thread Moon, John
Guys, This script: use strict; use warnings; my @array; for (0..3) { push @array, [$_:, 1, 2, 3]; } for (0..$#array) { my $row = $_; for (0..3) { my $col = $_; print $array[$row][$col], unless ($col == 3); print

RE: Help with array of arrays!

2004-10-13 Thread Beckett Richard-qswi266
Thanks to all those who helped, so far! :-) foreach ( @array ) { print join ( , , @{$_} ), \n; } This is the nice easy print statement I was looking for, but I don't quite understand it. I get the print, and the join, but what is @{$_} all about? Going back to the array: 1/1/2004 0 34.5

RE: Help with array of arrays!

2004-10-13 Thread Anderson, Mark (Service Delivery)
use strict; use warnings; my @array; for (0..3) { push @array, [$_:, 1, 2, 3]; } for my $R (@array) { print join(,, @$R) , \n; # for (0..3) { # my $col = $_; # print $array[$row][$col], unless ($col == 3); # print

RE: Help with array of arrays!

2004-10-13 Thread Anderson, Mark (Service Delivery)
b) find out how big it is (easily) c) have in interpolated all using the dereferencing syntax. -Original Message- From: Beckett Richard-qswi266 [SMTP:[EMAIL PROTECTED] Sent: 13 October 2004 15:48 To: '[EMAIL PROTECTED]' Subject: RE: Help with array of arrays

RE: Help with array of arrays!

2004-10-13 Thread Moon, John
Subject: RE: Help with array of arrays! Thanks to all those who helped, so far! :-) foreach ( @array ) { print join ( , , @{$_} ), \n; } This is the nice easy print statement I was looking for, but I don't quite understand it. I get the print, and the join, but what is @{$_} all about

Re: Help with array of arrays!

2004-10-13 Thread David Greenberg
@{$_} dereferences the array reference created with []. For instance, my $ref = [1,2,3]; is the same as my @arr = (1,2,3); my $ref = [EMAIL PROTECTED]; To access the array (1,2,3) using $ref, you need to say @{$ref} or, to access an individual element of it, you can say $ref-[0], $ref-[1],

RE: Help with array of arrays!

2004-10-13 Thread Thomas, Mark - BLS CTR
Gives: 0:, 1, 2, 3 1:, 1, 2, 3 2:, 1, 2, 3 3:, 1, 2, 3 Which is what I'd expect, and is designed to put the data into a csv file. First, is this the best way to do it, or is there a neater trick? This is a neat trick: use Template; my $template = Template-new || die