Jason,
Play with the script below:
my @a1 = qw( one ace );
my @a2 = qw( two deuce );
my @a3 = qw( thr tri );
my @a4 = qw( fou quad );
my @a5 = qw( fiv quat );
my @myarray = (\@a1, \@a2, \@a3, \@a4, \@a5);
foreach my $item (@myarray) {
my($item1, $item2) = @$item;
print "$item1 and $item2\n";
}
my @item;
foreach ( @myarray ) {
print "$$_[0] and $$_[1]\n";
}
"Jason Frisvold" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Here's another simple question.... I have an array of arrays and I want
to use a foreach to do something with each entry... currently I do this
:
foreach my $item (@myarray) {
my ($item1, $item2) = @$item;
<do stuff here>
}
Is there a way to combine the first 2 lines? Is it any faster and less
memory intensive? (granted it's not much now, but hey, I like
optimizing things to death...)
Something along the lines of :
foreach my ($item1, $item2) (@myarray) {
<do stuff>
}
That doesn't seem to work for me, so I'm at a loss as to how to do
this...
Thanks,
---------------------------
Jason H. Frisvold
Senior ATM Engineer
Engineering Dept.
Penteledata
CCNA Certified - CSCO10151622
[EMAIL PROTECTED]
---------------------------
"I love deadlines. I especially like the whooshing sound they make as
they go flying by." -- Douglas Adams [1952-2001]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]