Re: foreach, my, and arrays

2002-05-12 Thread drieux
On Monday, May 6, 2002, at 09:47 , Jason Frisvold wrote: > 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

Re: foreach, my, and arrays

2002-05-06 Thread Chas Owens
On Mon, 2002-05-06 at 12:04, Jason Frisvold wrote: > 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; > > } > > Is

RE: foreach, my, and arrays

2002-05-06 Thread Jason Frisvold
e 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 = q

Re: foreach, my, and arrays

2002-05-06 Thread Dave K
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

Re: foreach, my, and arrays

2002-05-06 Thread Michael Lamertz
On Mon, May 06, 2002 at 12:04:14PM -0400, Jason Frisvold wrote: > 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; >

foreach, my, and arrays

2002-05-06 Thread Jason Frisvold
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; } Is there a way to combine the first 2 lines? Is it any faster and le