Dave> Well it's quite simple actually. A BLOCK of Perl code is a BLOCK of
Perl code.
Dave> No matter where you put it. Typically anything inside a set of {}'s
is a block
Dave> of code. So the fact that a subroutine consists of a block of code
Dave>
Dave> sub foo { BLOCK }
Dave>
Dave> and map can use a block of code
Dave>
Dave> map { BLOCK } @list
Dave>
Dave> isn't too surprising.
This I think needs to be corrected slightly.
"Programming Perl -- 3rd Ed." in section named "Bare Blocks" ( chapter 4 )
says,
... Note that this is not true of the blocks in eval {}, sub {}, or much
to everyone's surprise, do {}. These three are not loop blocks because
they are not BLOCKs by themselves; ".
so in a certain sense, these differ. I sincerely feel there is something
more to it. Also, What really bothers me is "Evaluates BLOCK in a list
context". How do you evaluate a block in scalar context? Any light on this
( or a pointer ) maybe?
---- Regards,
Atul