in reply to Closure warning with Perl 5.14?
Remove the if after the declaration of $color. It serves no purpose and is leading to the error:
If you were ever to need initialize a variable conditionally, be sure to use the ternary operatormy $color = shift;
my $variable = $condition ? 'value' : undef;