in reply to Re^5: Passing argument by reference (for a scalar)
in thread Passing argument by reference (for a scalar)
+ is the unary-+ operator. It does absolutely nothing but evaluate to the same thing its operand does. It even provides the same context as the one in which it's evaluated.
+5 # Same as `5` +"abc" # Same as `"abc"` +@a # Same as `@a`, in both scalar and list context
${ shift } is just a weird undocumented way of writing $shift. I didn't want that. I wanted to use the shift operator. ${ +shift } can't be parsed as a scalar named +shift, so it has the desired effect.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Passing argument by reference (for a scalar)
by sleet (Pilgrim) on Sep 11, 2024 at 15:50 UTC | |
by ikegami (Patriarch) on Sep 13, 2024 at 10:20 UTC | |
|
Re^7: Passing argument by reference (for a scalar)
by etj (Priest) on Sep 11, 2024 at 04:36 UTC | |
by LanX (Saint) on Sep 11, 2024 at 10:50 UTC | |
by choroba (Cardinal) on Sep 11, 2024 at 11:35 UTC | |
by LanX (Saint) on Sep 11, 2024 at 15:13 UTC | |
by etj (Priest) on Sep 11, 2024 at 14:38 UTC | |
by LanX (Saint) on Sep 11, 2024 at 15:00 UTC |