in reply to Re: Transforming a for loop to a more functional approach?
in thread Transforming a for loop to a more functional approach?

No.
hbm and GrandFather's answer is the short and easy way to do it... and the more readable way.
PERL is not C. Mistaking it to be so really messes up things and makes you suffer bad performance, debugging and processing time.
  • Comment on Re^2: Transforming a for loop to a more functional approach?

Replies are listed 'Best First'.
Re^3: Transforming a for loop to a more functional approach?
by JavaFan (Canon) on Mar 03, 2009 at 13:20 UTC
    hbm and GrandFather's answer is the short and easy way to do it... and the more readable way.
    Yes, but both do something different than the code of the OP did. hbm and GrandFather both create a new hash - while the OP extends an existing hash. Now, if the hash was initially empty, this is the same thing. But we cannot decude that from the OP's snippet, so it would be quite bold to state what they did is the way of doing it. In fact, it's quite unPerlish to claim there exists the way of doing something.