Yeah, I thought of doing it that way too.... However, my purpose was to skip the "unnecessary" step and pump the data right into variables. This way I "drop" the memory needed to go that extra step and I retain readability of code...
I can live with it the way it is now, I guess... Just one of those things I like to try to optimize... :) --------------------------- Jason H. Frisvold Senior ATM Engineer Engineering Dept. Penteledata CCNA Certified - CSCO10151622 [EMAIL PROTECTED] --------------------------- "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world." -- Albert Einstein [1879-1955] -----Original Message----- From: Dave K [mailto:[EMAIL PROTECTED]] Sent: Monday, May 06, 2002 12:41 PM To: [EMAIL PROTECTED] Subject: Re: foreach, my, and arrays 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] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]