in reply to Re^2: Perl is more intuitive
in thread Perl is more intuitive
arr.each { | x | # iterates the elements, NOT the index puts x }
Basically, each here is just a method that recieves a block (like perl's anonymous subroutines) as an argument. The container type is then responsible for calling the block for each element.
Any class can provide it's own each method - this is not a built-in function like perl's foreach.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Perl is more intuitive
by kiat (Vicar) on Aug 19, 2005 at 13:44 UTC | |
by Joost (Canon) on Aug 19, 2005 at 14:08 UTC |