Neither of those declare locally anything but the first var. You'd have to do something like:# Local variables: SCALAR,SCALAR,... my $x, $y, $z; ... my $filename = "/path/to/file", $filemode = "immolate", $opmode = "seek", $filetype = "image/gif";
Just think of my as a really high precedence prefix operator that must appear before an lvalue, and you'll have the right mental model. But to figure the scalar-vs-arrayness of the rest of the expression, throw away all the my's first.my $x, my $y, my $z;
My preference is one variable per my declaration, unless it's a bunch of scalars and an optional terminating array being fed from a list (like a subroutine argument grab).
-- Randal L. Schwartz, Perl hacker
In reply to Re: Re: scalar my vs list my
by merlyn
in thread my $var = ''; vs. use constant VAR => '';
by antihero
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |