in reply to Re: Using an undefined value as a hashref
in thread Using an undefined value as a hashref

my accepts a single variable or a list of variables as argument(s), not array elements or slices.
Yes, but is it really a function, or does it just appear to behave like a function when you look at it sideways? (It does have a return value, but that's usually thrown away -- and does it behave the same way every time?)

Since my has both compile-time and run-time aspects, it's more of a convenience that you can actually do things like

my $x = 42;
If Perl were instead a little stricter in partitioning compile actions vs. execution, then my might be defined as a compiler directive:
my $x; my ($y,@z);
It's intentional laziness that we can initialize these variable declarations in the same statement. Even more so when non-constants like this work:
my @args = @_; my $x = $x; my @results = `some | funky | shell | result`;
We run into problems with my and its cousins because they gloss over some of the bookkeeping and other administrivia that we normally don't care to keep up with. When we try and make them do more work than they can, we find feechers that don't DWIM.

-QM
--
Quantum Mechanics: The dreams stuff is made of