Take this code:
$#mdCntrs = -1;
$#array
returns the index of last element of array and returns -1
when array is empty.
But this assigning -1
, what does that mean?
It changes the length of the array, in this case it will clear the entire array.
From perldoc perldata:
Assigning to
$#days
actually changes the length of the array. Shortening an array this way destroys intervening values.
It goes on to say:
The following are equivalent:
@whatever = (); $#whatever = -1;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With