in reply to Re^3: Map Vs Foreach
in thread Map Vs Foreach
You asked about the difference between lists and arrays. Here's an example of map operating on lists, not arrays:
say for map { "$_ squared is " . $_ ** 2 } 1 .. 10;If an operator operates on lists, Perl's list context ensures that it can handle arrays. If an operator operates on arrays (push, splice), it won't necessarily operate on lists.
|
|---|