in reply to Re: A list assignment gotcha (updated)
in thread Not understanding 2 sentences in perldoc

Exactly — they look analogous, but they are not. The List::MoreUtils tricks are interesting, but actually wrap a loop iterating over arrays instead of being a true "vectorized" modifying assignment. There is probably something in PDL for this if your program does that kind of processing, but for a simple case with a list of Perl scalars, you need to use multiple statements.

  • Comment on Re^2: A list assignment gotcha (updated)

Replies are listed 'Best First'.
Re^3: A list assignment gotcha (updated)
by etj (Priest) on Apr 21, 2022 at 07:26 UTC
    PDL is all about the "array programming", where you do an operation to the whole ndarray, and PDL just does that thing to everything in it. So for an ndarray, $pdl += 1 really would add 1 to all the elements in it.

    This is an example of the array-programming concept known these days as "broadcasting", which PDL used to slightly-confusingly call "threading".