It seems when I use my ($foo) = { }; to declare some globals it happened if I used my ($foo) = ""; to declare it it fixed the problem. Is there any issues using that way if it works? | [reply] |
Is there any issues using that way if it works?
my $foo = {}; # $foo a reference to an empty anonymous hash
my $foo = ""; # $foo contains an empty string
my $foo; # $foo is undef
If you are going to use the variable as a reference to a hash then by all means initialise it that way, if you are going to store text there then initialise it as an empty string, if storing numbers then initialise it to zero. If not sure, then leave it undef. | [reply] [d/l] |
| [reply] [d/l] |