in reply to
As a preventative measure, this is a good rule of thumb to follow:
Whenever you aren't sure if a variable has been assigned a value, give it one explicitly =)
The || operator is very useful here.
my $variable = $some_unknown_input || 'default';
my $foo = (defined $input ? $input : '');
In the first example, if $some_unknown_input is not a true value, $variable will be assigned 'default'.
In the second example, if $input is undefined (note this is not necessarily the same as being non-true, as in the first example)
, it is assigned an empty string.