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
In reply to Re^4: substr oddity
by Anonymous Monk
in thread Perl oddities
by brian_d_foy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |