in reply to Predeclaration


The my() declares the scope to the varaible and not the type. The type doesn't change.* In your example the variables will remain an array, a hash and a scalar no matter what you put into them.

Perhaps what you are really asking is whether there is any advantage of initialising variables like this. As far as I know there is no substantive difference between the two of these:

my @array; my @array = ();
However, you can gain some performance increase by pre-extending an array or a hash if you know what size it is likely to be:
my @array; $#array = 99; my %hash; keys %hash = 100;

--
John.

* Leaving arguments about bless() aside.