PERL problem

Dear KNIME users,

I am using KNIME for some model statistics analysis and encountered a strange behaviour of PERL node. My classification models assign either 0 or 1 to each record and then I use Value counter node to get the total number of 0s and 1s. Then on the obtained values I can calculate different model stats.

The problem is that sometimes there are no 0s or 1s at all and I get only 1 row (either with number of 0s or 1s) in the count column. The further calculations are then screwed as it is assumed that both values are available. There were no other nodes I saw useful to cope with that so I decided to write my own node with PERL scripting node. I transpose the table as this node work on columns.

In normal situation, I would have 2 columns: 1.0 and 0.0 with frequencies of corresponding occurences. Sometimes one of them is missing so I've written 2 PERL nodes to to cope with that and here is the one that deals with 1.0 column, whether missing or not:

my %hash_copy = %column; # I copy the hash as operations on %column are not allowed
my $key = '1.0';
return $column{ '1.0' } if exists $column{ '1.0' }; # If the value is there, I simply output it to new column

$hash_copy{'1.0'} = '0' if not exists $hash_copy{ $key }; # If the value is not there, I insert 0
return $hash_copy{ $key }; # and then return it


Now, the problem is that if the column 1.0 does not exists, it is not possible to check it with "if exists" because, as it seems to me, the KNIME checks whether I am making any references to non-existent columns in my PERL code. Also, if I tried referring to $hash_copy{ 1.0 } and there is always 0 there even if $column{ 1.0 } contains true value of existent.. The following warning is outputed to console:

WARN      Perl Scripting     Body Script [Line 16]: No such column: $column{'1.0'}.
Body Script [Line 16]: No such column: $column{'1.0'}.

Or maybe, my code is wrong and you may help me elucidating how it should look like. Either way, I need an external help with that issue.

Your suggestions are welcome.