http://www.perlmonks.org?node_id=436706


in reply to Re^3: substr oddity
in thread Perl oddities

Okay, I'm confused... is that your entire output? Was the word "Alive" in there somewhere?

It should print "Alive!" if the code doesn't crash. I don't see that in your output. If that's your entire output, then you get what I do: a crash on the substr() call. Similarly, you'll get the same kind of crash if you assign to substr(): that is, treat it like an Lvalue.

My guess is that because @_ can be assigned to, substr() behaves like an Lvalue when passed as a subroutine argument. If that's true, it's odd enough to be an oddity. :-)
--
Ytrew