M
Morfys
Is there a way to set the default value for undefined variables? For
example, in
my ($a, $b) = (split(/\s+/, $mytext))[0,1]
sometimes mytext will contain two (or more) words, and sometimes it
will contain only 1. In the latter case, I would like $b to be
initialized to "" not undef.
I have many statements (>60) of the above form with different
variables, and initializing
each variable $a = ""; b = ""; is a pain. Thanks.
example, in
my ($a, $b) = (split(/\s+/, $mytext))[0,1]
sometimes mytext will contain two (or more) words, and sometimes it
will contain only 1. In the latter case, I would like $b to be
initialized to "" not undef.
I have many statements (>60) of the above form with different
variables, and initializing
each variable $a = ""; b = ""; is a pain. Thanks.