my($num) = @_; # list context, same as ($num) = @_;
my $num = @_; # scalar context, same as $num = @_;
In the first one, $num gets the first parameter,
as a list-context assignment; in the second, it gets the number of
parameters, in a scalar context. Either line of code could be what
the programmer wanted; we can't tell from that one line alone,
and so Perl can't warn you if you use the wrong one. (Of
course, you wouldn't have both of those
lines in the same subroutine, since you can't have two lexical
variables with the same name declared in the same scope; this is just
an example.) So, when reading code like this, you can always tell the
context of the assignment by seeing what the context would be without
the word my.