RE: Help with array

2011-09-08 Thread Barry Brevik
Splice with a length of 0... I wish I had thought of that. Thank you! > Everybody's a 'newb' at stuff that haven't tried before. It > might help to think of inserting elements into an array as > replacing a section of length 0, when you read 'perldoc -f splice'. > > It might also be worth takin

RE: Help with array

2011-09-08 Thread Andy_Bach
> It might also be worth taking a look at slices, described in 'perldoc perldata'. It also *may* be worth rethinking your data model. Often (not always but ...) needing to insert something into a particular location in an array implies a hash might be a better structure. Just a thought. a --

RE: Help with array

2011-09-08 Thread Brian Raven
> -Original Message- > From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl- > win32-users-boun...@listserv.activestate.com] On Behalf Of Barry Brevik > Sent: 07 September 2011 18:48 > To: Tobias Hoellrich; perl-win32-users@listserv.ActiveState.com > Subj

RE: Help with array

2011-09-07 Thread Barry Brevik
perl-win32-users-boun...@listserv.activestate.com > [mailto:perl-win32-users-boun...@listserv.activestate.com] On > Behalf Of Tobias Hoellrich > Sent: Wednesday, September 07, 2011 10:41 AM > To: Barry Brevik > Cc: perl-win32-users@listserv.ActiveState.com > Subject: RE: Help with a

RE: Help with array

2011-09-07 Thread Tobias Hoellrich
perldoc -f splice Cheers - Tobias -Original Message- From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Barry Brevik Sent: Wednesday, September 07, 2011 11:38 AM To: perl-win32-users@listserv.ActiveState.com Su

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 Meir Guttman
day, March 07, 2011 6:07 PM 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, then disregard this comment... however if you are in control of the sql query that executes to oracle, you might wa

RE: Help with Array of Arrays

2011-03-07 Thread Ken Cornetet
$self{$description} = shift; bless ($self, $class); return $self; } 1; Ken Cornetet 812.482.8499 To err is human - to moo, bovine. -Original Message- From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com]

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 d

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 $T

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], etc.

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, bu

RE: Help with array of arrays!

2004-10-13 Thread Anderson, Mark (Service Delivery)
tell it's an array ref 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 PROTE

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 "$array[$ro

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 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 "$array[$

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 @

RE: help with array reference inside hash

2003-05-31 Thread Joseph P. Discenza
Erich C. Beyrent wrote, on Friday, May 30, 2003 15:37 : print STDOUT $data{"params"}."\n"; print STDOUT @{$data{"params"}},"\n"; Good luck, Joe == Joseph P. Discenza, Sr. Programmer/Analyst mailto:[EMAIL PROTEC