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]
1 4:05 PM
To: perl-win32-users@listserv.ActiveState.com
Subject: Help with Array of Arrays
I always get majorly confused when I have to deal with Arrays of Arrays,
Arrays of Hashes etc. The Camel book has a good section on this, but it
is not always enough. That's why each time I do one, I document it in a
file o
I always get majorly confused when I have to deal with Arrays of Arrays,
Arrays of Hashes etc. The Camel book has a good section on this, but it
is not always enough. That's why each time I do one, I document it in a
file on my disk. However, I have not done this one before.
I am extracting Bill
> 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
col == 3);
# print "$array[$row][$col]\n" if ($col == 3);
# }
}
> -Original Message-
> From: Beckett Richard-qswi266 [SMTP:[EMAIL PROTECTED]
> Sent: 13 October 2004 14:44
> To: '[EMAIL PROTECTED]'
> Subject: Help with ar
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 @
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[$
14 matches
Mail list logo