Re: map vs foreach

2014-09-30 Thread Shawn H Corey
On Tue, 30 Sep 2014 16:38:24 -0700 SSC_perl wrote: > On Sep 30, 2014, at 4:08 PM, Shawn H Corey wrote: > > code like you will have to read it after an all-night party > > (some day, you will). > > Those days are over, but point taken! ;) They're never over but they do get farther apart.

Re: map vs foreach

2014-09-30 Thread Uri Guttman
On 09/30/2014 05:08 PM, SSC_perl wrote: Is the output of these two lines equivalent? map { $hash->{$_} = shift @record } @{$self->{'FIELDNAMES'}}; $hash->{$_} = shift @record foreach @{$self->{'FIELDNAMES'}}; They appear to be in my testing, but I'd like to make sure.

Re: map vs foreach

2014-09-30 Thread SSC_perl
On Sep 30, 2014, at 4:19 PM, David Precious wrote: > So, e.g.: > > my %fields = map { $_ => shift @record } @{$self->{'FIELDNAMES'}}; > > ... would make sense, because you're using map to produce the data you > want, rather than using it instead of a for loop. Thanks, David. That was an

Re: map vs foreach

2014-09-30 Thread SSC_perl
On Sep 30, 2014, at 4:08 PM, Shawn H Corey wrote: > code like you will have to read it after an all-night party > (some day, you will). Those days are over, but point taken! ;) Thanks, Frank SurfShopCART https://github.com/surfshopcart/surfshop -- To unsubscribe, e-mail: beginners-uns

Re: map vs foreach

2014-09-30 Thread David Precious
On Tue, 30 Sep 2014 14:08:14 -0700 SSC_perl wrote: > Is the output of these two lines equivalent? > > map { $hash->{$_} = shift @record } @{$self->{'FIELDNAMES'}}; > > $hash->{$_} = shift @record foreach @{$self->{'FIELDNAMES'}}; [...] > Is one more appropriate than the other in a s

Re: map vs foreach

2014-09-30 Thread Shawn H Corey
On Tue, 30 Sep 2014 14:08:14 -0700 SSC_perl wrote: > Is the output of these two lines equivalent? > > map { $hash->{$_} = shift @record } @{$self->{'FIELDNAMES'}}; > > $hash->{$_} = shift @record foreach @{$self->{'FIELDNAMES'}}; > > They appear to be in my testing, but I'd like to

Re: map vs foreach

2014-09-30 Thread Omega -1911
Is asking a preference-based question appropriate for a beginners list appropriate? Question for you: Have you updated your software to have a more modern look and feel or does it still resemble 1995? I ask because, in your own words, you said "or is it simply a styling difference?". Feedback for

map vs foreach

2014-09-30 Thread SSC_perl
Is the output of these two lines equivalent? map { $hash->{$_} = shift @record } @{$self->{'FIELDNAMES'}}; $hash->{$_} = shift @record foreach @{$self->{'FIELDNAMES'}}; They appear to be in my testing, but I'd like to make sure. Is one more appropriate than the other in