int one_variable = 32; int another_variable = 35; float some_float; #### typedef struct { float one; float two; int three; bool potato; } struct_name; #### verify("foobar.one = 0.0", foobar.one, (float)0.0); verify("foobar.two = 0.0", foobar.two, (float)0.0); verify("foobar.three = 0", foobar.three, (int)0); verify("foobar.potato = false", foobar.potato, (bool)false); #### my %default_values = ( 'int' => '0', 'float' => '0.0', 'bool' => 'false' ); # Oooog: my %structs = ( 'struct_name' => [ [ 'float', 'one', '0.0' ], [ 'float', 'two', '0.0' ], [ 'int', 'three', '0' ], [ 'bool', 'potato', 'false' ] ] ); # more stuff here, then when I am checking the variable type: if (exists $default_values{$type}) { print $output " verify(\"$short_var = $default_values{$type}\",\n"; print $output " $variable"."[i],\n"; print $output " ($type)$default_values{$type});\n"; } elsif (exists $structs{$type}) { my $array_ref = $structs{$type}; foreach my $object_ref (@{$array_ref}) { print $output " verify(\"$short_var.@{$object_ref}[1] = @{$object_ref}[2]\",\n"; print $output " $variable.@{$object_ref}[1],\n"; print $output " (@{$object_ref}[0])@{$object_ref}[2]);\n"; } }