Re: Explicit return and anonymous hashes

2009-11-12 Thread Shawn H Corey
Philip Potter wrote: > My question runs deeper than this. What are the criteria? When are > curlies a bare block and when are they an anonymous hash? What are the > grammar rules? How could I have known a priori to put a "return" or > "+" in? > > The camel book page 247 says "you may occasionally

Re: Explicit return and anonymous hashes

2009-11-12 Thread Philip Potter
2009/11/12 Peter Scott : > On Thu, 12 Nov 2009 09:55:39 +, Philip Potter wrote: >> 2009/11/11 Shawn H Corey : >>> no warnings 'once'; >>> my @aoh = pairwise { +{ %{$a}, %{$b} } } @aoh_a, @aoh_b; >> >> Thanks for your response. What are the grammar rules here? Why must I >> use an explicit retur

Re: Explicit return and anonymous hashes

2009-11-12 Thread Peter Scott
On Thu, 12 Nov 2009 09:55:39 +, Philip Potter wrote: > 2009/11/11 Shawn H Corey : >> no warnings 'once'; >> my @aoh = pairwise { +{ %{$a}, %{$b} } } @aoh_a, @aoh_b; > > Thanks for your response. What are the grammar rules here? Why must I > use an explicit return or unary + operator? Why is it

Re: Explicit return and anonymous hashes

2009-11-12 Thread Philip Potter
2009/11/11 Shawn H Corey : > Philip Potter wrote: >> my @aoh = pairwise { { %{$a}, %{$b} } } @aoh_a, @aoh_b; > > no warnings 'once'; > my @aoh = pairwise { +{ %{$a}, %{$b} } } @aoh_a, @aoh_b; Thanks for your response. What are the grammar rules here? Why must I use an explicit return or unary + op

Re: Explicit return and anonymous hashes

2009-11-11 Thread Shawn H Corey
Philip Potter wrote: > I am playing with List::MoreUtils::pairwise and noticed some funny > behaviour. > p...@tui:~/tmp$ cat bar.pl > use strict; > use warnings; > > use List::MoreUtils qw(pairwise); > use Data::Dumper; > > my @aoh_a = ( { foo => 1, bar => 2 }, {foo => 3, bar => 4} ); > my @aoh_b

Explicit return and anonymous hashes

2009-11-11 Thread Philip Potter
I am playing with List::MoreUtils::pairwise and noticed some funny behaviour. I'm trying to merge two lists of hashes into one list of hashes: p...@tui:~/tmp$ cat bar.pl use strict; use warnings; use List::MoreUtils qw(pairwise); use Data::Dumper; my @aoh_a = ( { foo => 1, bar => 2 }, {foo => 3,