in reply to Re: scalar my vs list my
in thread my $var = ''; vs. use constant VAR => '';
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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: scalar my vs list my
by $code or die (Deacon) on Apr 27, 2001 at 01:56 UTC | |
by tadman (Prior) on Apr 27, 2001 at 02:12 UTC |