I found that I can declare two variables in one statement using:
my ($a,$b)=(1,2); But I think this syntax may be confusing, for instance, if we had five variables declarations, it would be difficult to see which value belongs to which variable. So I think it would be better if we could use this syntax:
my $a=1, $b=2; I wonder, why is this kind of declaration not possible in Perl? And are there any alternatives?
(I am trying to avoid repeating my for each declaration like: my $a=1; my $b=2;)
myis annoying and noise. It's kinda like how SQL's UPDATE syntax is better than its INSERT syntax.(my $a=1), (my $b=2);but that seems worse thanmy $a=1; my $b=2;.