As in the following example with $DimensionSwitch, I like to reuse the names of variables. I know $DimensionSwitch is lexically scoped, so it doesn't appear to cause any problems, but (1) might it cause problems somewhere that I don't know about and therefore (2) is it poor practice to reuse variable names in Perl?
my $DimensionSwitch = checkDimensions(\@coefficients,\@predictors);
sub checkDimensions{
my @a1 = @{$_[0]};
my @a2 = @{$_[1]};
my $Size1 = @a1;
my $Size2 = @a2;
my $DimensionSwitch;
if ($Size1 == $Size2){
$DimensionSwitch = 1;
}else{
$DimensionSwitch = 0;
}
return $DimensionSwitch;
}