What does this perl snippet with unary plus do?
join( '/', splice @t, 0, +@d )
This is from File::Path.pm line 267, and I'm trying to understand it. According to the documentation, unary plus does nothing. Also the 3rd argument to splice is an integer, not an array. Does this actually do a scalar(@d)? Thanks for your help. I'm trying to translate this code with my Pythonizer to python.
I tried using -MO=Deparse and all it does is eat the + and move the parens around:
join '/', splice(@t, 0, @d);
The unary
+is sometimes useful to tell the parser how to interpret the following expression. See perlop:In this particular case, though, it does nothing, as the
@dis parsed as the third argument to splice. Maybe the author wanted it to be evaluated in scalar context, but it works that way regardless of the presence of the+.