1434cga / CGA_RDL

replacement definition language like ASDL
4 stars 2 forks source link

bug : if we access multi-dimension hash , this hash was made when it access. #60

Closed cheoljoo closed 3 years ago

cheoljoo commented 3 years ago

if we access $macro{test}{0} , perl makes $macro{test} room.

our %macro = {};
if($macro{test}{0} eq ""){
  print "it is not accessed\n but $macro{test} was defined\n";
}
foreach my $key (keys %macro){
  print "$key\n";    # test will be printed,  but we do not get this result.
}
cheoljoo commented 3 years ago

use isDefinedHash()

our %macro = {};
if(isDefinedHash("macro{test}{0}") eq ""){
  print "it is not accessed\n but $macro{test} was defined\n";
}
foreach my $key (keys %macro){
  print "$key\n";    # print nothing
}