in reply to Re: Question on use of 'my'
in thread Question on use of 'my'
Ditto's that it's mostly a matter of style, but there are contextual differences between them so they're not strictly equivalent. Keep in mind that my( $x, $y ) = EXPR provides list context to the expression which can affect the value to which it evaluates.
Update: Just to clarify with a common gotcha, my $foo = /(bar|baz)/; is not the same as my( $foo ) = /(bar|baz)/ (but the later is the same as my $foo = ( /(bar|baz)/ )[0]).
Update: Or another one: my $x = ( 3, 2, 1 ) versus my( $x ) = ( 3, 2, 1 ).
|
|---|