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
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
$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]
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
> 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
@{$_} 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.
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
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
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
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
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[$
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 @
12 matches
Mail list logo